|
|
d004d8 |
From 67fdfef9a786fdd08da5456fca6fb30ff0d27be0 Mon Sep 17 00:00:00 2001
|
|
|
d004d8 |
From: Kamil Dudka <kdudka@redhat.com>
|
|
|
d004d8 |
Date: Mon, 24 Apr 2017 15:01:04 +0200
|
|
|
d004d8 |
Subject: [PATCH] nss: do not leak PKCS #11 slot while loading a key
|
|
|
d004d8 |
|
|
|
d004d8 |
It could prevent nss-pem from being unloaded later on.
|
|
|
d004d8 |
|
|
|
d004d8 |
Bug: https://bugzilla.redhat.com/1444860
|
|
|
d004d8 |
|
|
|
d004d8 |
Upstream-commit: c8ea86f377a2f341db635ec96f99314023b5a8f3
|
|
|
d004d8 |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
d004d8 |
---
|
|
|
d004d8 |
lib/nss.c | 6 ++++--
|
|
|
d004d8 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
d004d8 |
|
|
|
d004d8 |
diff --git a/lib/nss.c b/lib/nss.c
|
|
|
d004d8 |
index b73a1e8..86775b4 100644
|
|
|
d004d8 |
--- a/lib/nss.c
|
|
|
d004d8 |
+++ b/lib/nss.c
|
|
|
d004d8 |
@@ -551,7 +551,7 @@ fail:
|
|
|
d004d8 |
static CURLcode nss_load_key(struct connectdata *conn, int sockindex,
|
|
|
d004d8 |
char *key_file)
|
|
|
d004d8 |
{
|
|
|
d004d8 |
- PK11SlotInfo *slot;
|
|
|
d004d8 |
+ PK11SlotInfo *slot, *tmp;
|
|
|
d004d8 |
SECStatus status;
|
|
|
d004d8 |
CURLcode rv;
|
|
|
d004d8 |
struct ssl_connect_data *ssl = conn->ssl;
|
|
|
d004d8 |
@@ -568,7 +568,9 @@ static CURLcode nss_load_key(struct connectdata *conn, int sockindex,
|
|
|
d004d8 |
return CURLE_SSL_CERTPROBLEM;
|
|
|
d004d8 |
|
|
|
d004d8 |
/* This will force the token to be seen as re-inserted */
|
|
|
d004d8 |
- SECMOD_WaitForAnyTokenEvent(mod, 0, 0);
|
|
|
d004d8 |
+ tmp = SECMOD_WaitForAnyTokenEvent(mod, 0, 0);
|
|
|
d004d8 |
+ if(tmp)
|
|
|
d004d8 |
+ PK11_FreeSlot(tmp);
|
|
|
d004d8 |
PK11_IsPresent(slot);
|
|
|
d004d8 |
|
|
|
d004d8 |
status = PK11_Authenticate(slot, PR_TRUE,
|
|
|
d004d8 |
--
|
|
|
d004d8 |
2.13.5
|
|
|
d004d8 |
|