andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 37a7c09eecbd17e9a72d39878d806f689ac1746f Mon Sep 17 00:00:00 2001
dc8c34
From: Rich Megginson <rmeggins@redhat.com>
dc8c34
Date: Tue, 26 Nov 2013 08:14:07 -0700
dc8c34
Subject: [PATCH 149/225] Ticket #47596 attrcrypt fails to find unlocked key
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47596
dc8c34
Reviewed by: nkinder (Thanks!)
dc8c34
Branch: 389-ds-base-1.2.11
dc8c34
Fix Description: Additional fix to the previous fix.  As it turns out, the
dc8c34
function PK11_IsLoggedIn() only returns true if the slot has been unlocked
dc8c34
with a pin or password.  If the slot does not need a login at all, because
dc8c34
the cert/key db has no password, PK11_IsLoggedIn will return false.  The code
dc8c34
must check for PK11_NeedLogin too.
dc8c34
Platforms tested: RHEL6 x86_64
dc8c34
Flag Day: no
dc8c34
Doc impact: no
dc8c34
(cherry picked from commit e66c4cecc47eff659a72a51c1e1722fb41c1dfbc)
dc8c34
(cherry picked from commit f608a943745e51fe4b5dbfb18bada2e2d13e0d6a)
dc8c34
(cherry picked from commit 5d2a20b4881d5374a9088ed1504b2d7e753976bb)
dc8c34
(cherry picked from commit 33df11ea7a9cbef5f78fe0d43da8a1c77b0a6c98)
dc8c34
(cherry picked from commit 326d636ed48142acd418073c1e22061e6b7757cc)
dc8c34
---
dc8c34
 ldap/servers/slapd/ssl.c | 2 +-
dc8c34
 1 file changed, 1 insertion(+), 1 deletion(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/ssl.c b/ldap/servers/slapd/ssl.c
dc8c34
index 8b80acb..61809aa 100644
dc8c34
--- a/ldap/servers/slapd/ssl.c
dc8c34
+++ b/ldap/servers/slapd/ssl.c
dc8c34
@@ -1602,7 +1602,7 @@ slapd_get_unlocked_key_for_cert(CERTCertificate *cert, void *pin_arg)
dc8c34
 			slapi_log_error(SLAPI_LOG_TRACE, "slapd_get_unlocked_key_for_cert",
dc8c34
 					"Missing slot for slot list element for certificate [%s]\n",
dc8c34
 					certsubject);
dc8c34
-		} else if (PK11_IsLoggedIn(slot, pin_arg)) {
dc8c34
+		} else if (!PK11_NeedLogin(slot) || PK11_IsLoggedIn(slot, pin_arg)) {
dc8c34
 			key = PK11_FindKeyByDERCert(slot, cert, pin_arg);
dc8c34
 			slapi_log_error(SLAPI_LOG_TRACE, "slapd_get_unlocked_key_for_cert",
dc8c34
 					"Found unlocked slot [%s] token [%s] for certificate [%s]\n",
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34