Blame SOURCES/nss-softokn-allow-level1.patch

5297d5
diff -up ./nss/lib/softoken/fipstokn.c.allow_level1 ./nss/lib/softoken/fipstokn.c
5297d5
--- ./nss/lib/softoken/fipstokn.c.allow_level1	2013-10-11 11:47:31.265670032 -0700
5297d5
+++ ./nss/lib/softoken/fipstokn.c	2013-10-11 11:58:12.730655827 -0700
5297d5
@@ -97,6 +97,7 @@ libaudit_init(void)
5297d5
  * ******************** Password Utilities *******************************
5297d5
  */
5297d5
 static PRBool isLoggedIn = PR_FALSE;
5297d5
+static PRBool isLevel2 = PR_TRUE;
5297d5
 PRBool sftk_fatalError = PR_FALSE;
5297d5
 
5297d5
 /*
5297d5
@@ -197,7 +198,7 @@ static CK_RV sftk_newPinCheck(CK_CHAR_PT
5297d5
 static CK_RV sftk_fipsCheck(void) {
5297d5
     if (sftk_fatalError) 
5297d5
 	return CKR_DEVICE_ERROR;
5297d5
-    if (!isLoggedIn) 
5297d5
+    if (isLevel2 && !isLoggedIn) 
5297d5
 	return CKR_USER_NOT_LOGGED_IN;
5297d5
     return CKR_OK;
5297d5
 }
5297d5
@@ -498,6 +499,7 @@ CK_RV FC_Initialize(CK_VOID_PTR pReserve
5297d5
 	return crv;
5297d5
     }
5297d5
     nsf_init = PR_TRUE;
5297d5
+    isLevel2 = PR_TRUE; /* assume level 2 unless we learn otherwise */
5297d5
 
5297d5
     return CKR_OK;
5297d5
 }
5297d5
@@ -552,8 +554,11 @@ CK_RV FC_GetSlotInfo(CK_SLOT_ID slotID,
5297d5
     CHECK_FORK();
5297d5
 
5297d5
     crv = NSC_GetTokenInfo(slotID,pInfo);
5297d5
-    if (crv == CKR_OK) 
5297d5
-       pInfo->flags |= CKF_LOGIN_REQUIRED;
5297d5
+    if (crv == CKR_OK) {
5297d5
+	if ((pInfo->flags & CKF_LOGIN_REQUIRED) == 0) {
5297d5
+	    isLevel2 = PR_FALSE;
5297d5
+ 	}
5297d5
+    }
5297d5
     return crv;
5297d5
 
5297d5
 }