Index: mozilla/security/nss/lib/pk11wrap/pk11util.c |
=================================================================== |
--- mozilla/security/nss/lib/pk11wrap/pk11util.c (revision 158129) |
+++ mozilla/security/nss/lib/pk11wrap/pk11util.c (working copy) |
@@ -14,6 +14,7 @@ |
#include "secerr.h" |
#include "dev.h" |
#include "pkcs11ni.h" |
+#include "utilpars.h" |
/* these are for displaying error messages */ |
@@ -1082,7 +1083,7 @@ |
} |
SECMOD_ReleaseReadLock(moduleLock); |
/* if everything was perm modules, don't lock up forever */ |
- if (!removableSlotsFound) { |
+ if ((mod->slotCount !=0) && !removableSlotsFound) { |
error =SEC_ERROR_NO_SLOT_SELECTED; |
PZ_Lock(mod->refLock); |
break; |
@@ -1251,6 +1252,9 @@ |
ret = PR_TRUE; |
break; |
} |
+ if (mod->slotCount == 0 ) { |
+ ret = PR_TRUE; |
+ } |
SECMOD_ReleaseReadLock(moduleLock); |
return ret; |
} |
@@ -1368,7 +1372,7 @@ |
} |
/* we've found the slot, now build the moduleSpec */ |
- escSpec = secmod_DoubleEscape(moduleSpec, '>', ']'); |
+ escSpec = NSSUTIL_DoubleEscape(moduleSpec, '>', ']'); |
if (escSpec == NULL) { |
PK11_FreeSlot(slot); |
return NULL; |
@@ -1389,7 +1393,17 @@ |
return NULL; |
} |
- return SECMOD_FindSlotByID(mod, slotID); |
+ slot = SECMOD_FindSlotByID(mod, slotID); |
+ if (slot) { |
+ /* if we are in the delay period for the "isPresent" call, reset |
+ * the delay since we know things have probably changed... */ |
+ if (slot->nssToken && slot->nssToken->slot) { |
+ nssSlot_ResetDelay(slot->nssToken->slot); |
+ } |
+ /* force the slot info structures to properly reset */ |
+ (void)PK11_IsPresent(slot); |
+ } |
+ return slot; |
} |
/* |