summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrelyea%netscape.com <devnull@localhost>2002-06-11 23:33:25 +0000
committerrelyea%netscape.com <devnull@localhost>2002-06-11 23:33:25 +0000
commit436bc0d964597ecca9967bd3e5e03ce9f8e93534 (patch)
tree2602dba38c94b68e53a41caf6a1d16e8aeb42c41
parent619a24243de915e90f781b4a661173ff601c7a60 (diff)
downloadnss-hg-436bc0d964597ecca9967bd3e5e03ce9f8e93534.tar.gz
When checking NeedInit status, go back and check the token in case the token
has been initialized offline.
-rw-r--r--security/nss/lib/pk11wrap/pk11slot.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/security/nss/lib/pk11wrap/pk11slot.c b/security/nss/lib/pk11wrap/pk11slot.c
index 6d93bc650..706509588 100644
--- a/security/nss/lib/pk11wrap/pk11slot.c
+++ b/security/nss/lib/pk11wrap/pk11slot.c
@@ -2197,6 +2197,19 @@ PK11_GetTokenInfo(PK11SlotInfo *slot, CK_TOKEN_INFO *info)
PRBool
PK11_NeedUserInit(PK11SlotInfo *slot)
{
+ PRBool needUserInit = (PRBool) ((slot->flags & CKF_USER_PIN_INITIALIZED)
+ == 0);
+
+ if (needUserInit) {
+ CK_TOKEN_INFO info;
+ SECStatus rv;
+
+ /* see if token has been initialized off line */
+ rv = PK11_GetTokenInfo(slot, &info);
+ if (rv == SECSuccess) {
+ slot->flags = info.flags;
+ }
+ }
return (PRBool)((slot->flags & CKF_USER_PIN_INITIALIZED) == 0);
}