Detect Active Card presents and disable PROTECTED_PIN_PATH login when found.
authorrelyea%netscape.com
Thu, 25 Apr 2002 21:24:47 +0000
changeset 3062 9232d7c6b0f1dced10c0762dc34cd7273cf5ef7d
parent 3060 bf1d8bde425e7a48723b622e772bc28c26873f13
child 3065 68cd3999c9c5cddd7b6c4fecd4d95f33b43413d1
push idunknown
push userunknown
push dateunknown
Detect Active Card presents and disable PROTECTED_PIN_PATH login when found.
security/nss/lib/pk11wrap/pk11slot.c
security/nss/lib/pk11wrap/secmodti.h
--- a/security/nss/lib/pk11wrap/pk11slot.c
+++ b/security/nss/lib/pk11wrap/pk11slot.c
@@ -1706,19 +1706,17 @@ PK11_InitToken(PK11SlotInfo *slot, PRBoo
     slot->readOnly = ((tokenInfo.flags & CKF_WRITE_PROTECTED) ? 
 							PR_TRUE : PR_FALSE);
     slot->hasRandom = ((tokenInfo.flags & CKF_RNG) ? PR_TRUE : PR_FALSE);
     slot->protectedAuthPath =
     		((tokenInfo.flags & CKF_PROTECTED_AUTHENTICATION_PATH) 
 							? PR_TRUE : PR_FALSE);
     /* on some platforms Active Card incorrectly sets the 
      * CKF_PROTECTED_AUTHENTICATION_PATH bit when it doesn't mean to. */
-#define ACTIVE_CARD "ActivCard SA"
-    if (PORT_Strncmp(tokenInfo.manufacturerID,ACTIVE_CARD,
-						sizeof(ACTIVE_CARD)-1) == 0) {
+    if (slot->isActiveCard) {
 	slot->protectedAuthPath = PR_FALSE;
     }
     tmp = PK11_MakeString(NULL,slot->token_name,
 			(char *)tokenInfo.label, sizeof(tokenInfo.label));
     slot->minPassword = tokenInfo.ulMinPinLen;
     slot->maxPassword = tokenInfo.ulMaxPinLen;
     PORT_Memcpy(slot->serial,tokenInfo.serialNumber,sizeof(slot->serial));
 
@@ -1884,16 +1882,19 @@ PK11_InitSlot(SECMODModule *mod,CK_SLOT_
     slot->module = mod; /* NOTE: we don't make a reference here because
 			 * modules have references to their slots. This
 			 * works because modules keep implicit references
 			 * from their slots, and won't unload and disappear
 			 * until all their slots have been freed */
     tmp = PK11_MakeString(NULL,slot->slot_name,
 	 (char *)slotInfo.slotDescription, sizeof(slotInfo.slotDescription));
     slot->isHW = (PRBool)((slotInfo.flags & CKF_HW_SLOT) == CKF_HW_SLOT);
+#define ACTIVE_CARD "ActivCard SA"
+    slot->isActiveCard = (PRBool)(PORT_Strncmp(slotInfo.manufacturerID,
+				ACTIVE_CARD, sizeof(ACTIVE_CARD)-1) == 0);
     if ((slotInfo.flags & CKF_REMOVABLE_DEVICE) == 0) {
 	slot->isPerm = PR_TRUE;
 	/* permanment slots must have the token present always */
 	if ((slotInfo.flags & CKF_TOKEN_PRESENT) == 0) {
 	    slot->disabled = PR_TRUE;
 	    slot->reason = PK11_DIS_TOKEN_NOT_PRESENT;
 	    return; /* nothing else to do */
 	}
--- a/security/nss/lib/pk11wrap/secmodti.h
+++ b/security/nss/lib/pk11wrap/secmodti.h
@@ -125,16 +125,17 @@ struct PK11SlotInfoStr {
      * allow them to become null terminated strings */
     char slot_name[65];
     char token_name[33];
     PRBool hasRootCerts;
     PRBool hasRootTrust;
     PRBool hasRSAInfo;
     CK_FLAGS RSAInfoFlags;
     PRBool protectedAuthPath;
+    PRBool isActiveCard;
     /* for Stan */
     NSSToken *nssToken;
 };
 
 /* Symetric Key structure. Reference Counted */
 struct PK11SymKeyStr {
     CK_MECHANISM_TYPE type;	/* type of operation this key was created for*/
     CK_OBJECT_HANDLE  objectID; /* object id of this key in the slot */