Chromium Code Reviews| Index: mozilla/security/nss/lib/pk11wrap/pk11auth.c |
| =================================================================== |
| --- mozilla/security/nss/lib/pk11wrap/pk11auth.c (revision 164196) |
| +++ mozilla/security/nss/lib/pk11wrap/pk11auth.c (working copy) |
| @@ -46,7 +46,7 @@ |
| * succeed if the user is already logged in. |
| */ |
| SECStatus |
| -pk11_CheckPassword(PK11SlotInfo *slot,char *pw) |
| +pk11_CheckPassword(PK11SlotInfo *slot,char *pw,PRBool contextSpecific) |
| { |
| int len = 0; |
| CK_RV crv; |
| @@ -67,7 +67,8 @@ |
| do { |
| PK11_EnterSlotMonitor(slot); |
| - crv = PK11_GETTAB(slot)->C_Login(slot->session,CKU_USER, |
| + crv = PK11_GETTAB(slot)->C_Login(slot->session, |
| + contextSpecific ? CKU_CONTEXT_SPECIFIC : CKU_USER, |
| (unsigned char *)pw,len); |
| slot->lastLoginCheck = 0; |
| mustRetry = PR_FALSE; |
| @@ -75,6 +76,7 @@ |
| switch (crv) { |
| /* if we're already logged in, we're good to go */ |
| case CKR_OK: |
| + /* TODO If it was for CKU_CONTEXT_SPECIFIC should we do this */ |
|
wtc
2012/11/07 22:12:33
Indentation looks wrong.
|
| slot->authTransact = PK11_Global.transaction; |
| /* Fall through */ |
| case CKR_USER_ALREADY_LOGGED_IN: |
| @@ -240,7 +242,7 @@ |
| NeedAuth = PR_TRUE; |
| } |
| } |
| - if (NeedAuth) PK11_DoPassword(slot,PR_TRUE,wincx); |
| + if (NeedAuth) PK11_DoPassword(slot,PR_TRUE,wincx,PR_FALSE); |
| } |
| void |
| @@ -299,7 +301,7 @@ |
| SECStatus |
| PK11_Authenticate(PK11SlotInfo *slot, PRBool loadCerts, void *wincx) { |
| if (pk11_LoginStillRequired(slot,wincx)) { |
| - return PK11_DoPassword(slot,loadCerts,wincx); |
| + return PK11_DoPassword(slot,loadCerts,wincx,PR_FALSE); |
| } |
| return SECSuccess; |
| } |
| @@ -530,7 +532,8 @@ |
| * of the PKCS 11 module. |
| */ |
| SECStatus |
| -PK11_DoPassword(PK11SlotInfo *slot, PRBool loadCerts, void *wincx) |
| +PK11_DoPassword(PK11SlotInfo *slot, PRBool loadCerts, void *wincx, |
| + PRBool contextSpecific) |
| { |
| SECStatus rv = SECFailure; |
| char * password; |
| @@ -599,7 +602,7 @@ |
| break; |
| } |
| } |
| - rv = pk11_CheckPassword(slot,password); |
| + rv = pk11_CheckPassword(slot,password,contextSpecific); |
| PORT_Memset(password, 0, PORT_Strlen(password)); |
| PORT_Free(password); |
| if (rv != SECWouldBlock) break; |