Bug 1320708, strsclnt: Avoid infloop if DB is created without password, r=kaie
authorDaiki Ueno <dueno@redhat.com>
Wed, 23 Aug 2017 15:46:08 +0200
changeset 13550 37cc4e60403e02d6066b4b83bd76af91a8960f5a
parent 13549 8cb110cb39eb003816c654c6f6ce93541f43b6e8
child 13551 b554de9d2bd5f99ce9f6362424973e0a0bbe718e
push id2341
push userkaie@kuix.de
push dateFri, 25 Aug 2017 19:56:58 +0000
reviewerskaie
bugs1320708
Bug 1320708, strsclnt: Avoid infloop if DB is created without password, r=kaie
cmd/strsclnt/strsclnt.c
--- a/cmd/strsclnt/strsclnt.c
+++ b/cmd/strsclnt/strsclnt.c
@@ -881,18 +881,20 @@ FindCertAndKey(cert_and_key *Cert_And_Ke
         return PR_FALSE;
     }
 }
 
 PRBool
 LoggedIn(CERTCertificate *cert, SECKEYPrivateKey *key)
 {
     if ((cert->slot) && (key->pkcs11Slot) &&
-        (PR_TRUE == PK11_IsLoggedIn(cert->slot, NULL)) &&
-        (PR_TRUE == PK11_IsLoggedIn(key->pkcs11Slot, NULL))) {
+        (!PK11_NeedLogin(cert->slot) ||
+         PR_TRUE == PK11_IsLoggedIn(cert->slot, NULL)) &&
+        (!PK11_NeedLogin(key->pkcs11Slot) ||
+         PR_TRUE == PK11_IsLoggedIn(key->pkcs11Slot, NULL))) {
         return PR_TRUE;
     }
 
     return PR_FALSE;
 }
 
 SECStatus
 StressClient_GetClientAuthData(void *arg,