зеркало из https://github.com/mozilla/pjs.git
Back out rev 1.90. It breaks shlibsign.
This commit is contained in:
Родитель
0761a4345d
Коммит
66a5f14215
|
@ -2455,9 +2455,6 @@ pk11_DBVerify(PK11Slot *slot)
|
|||
return;
|
||||
}
|
||||
|
||||
/* forward static declaration. */
|
||||
static CK_RV pk11_DestroySlotData(PK11Slot *slot);
|
||||
|
||||
/*
|
||||
* initialize one of the slot structures. figure out which by the ID
|
||||
*/
|
||||
|
@ -2488,40 +2485,47 @@ PK11_SlotInit(char *configdir,pk11_token_parameters *params, int moduleIndex)
|
|||
|
||||
#ifdef PKCS11_USE_THREADS
|
||||
slot->slotLock = PZ_NewLock(nssILockSession);
|
||||
if (slot->slotLock == NULL)
|
||||
goto mem_loser;
|
||||
slot->sessionLock = PORT_ZNewArray(PZLock *, slot->numSessionLocks);
|
||||
if (slot->sessionLock == NULL)
|
||||
goto mem_loser;
|
||||
if (slot->slotLock == NULL) {
|
||||
return CKR_HOST_MEMORY;
|
||||
}
|
||||
slot->sessionLock = (PZLock **)
|
||||
PORT_ZAlloc(slot->numSessionLocks * sizeof(PZLock *));
|
||||
if (slot->sessionLock == NULL) {
|
||||
return CKR_HOST_MEMORY;
|
||||
}
|
||||
for (i=0; i < slot->numSessionLocks; i++) {
|
||||
slot->sessionLock[i] = PZ_NewLock(nssILockSession);
|
||||
if (slot->sessionLock[i] == NULL)
|
||||
goto mem_loser;
|
||||
if (slot->sessionLock[i] == NULL) return CKR_HOST_MEMORY;
|
||||
}
|
||||
slot->objectLock = PZ_NewLock(nssILockObject);
|
||||
if (slot->objectLock == NULL)
|
||||
goto mem_loser;
|
||||
if (slot->objectLock == NULL) return CKR_HOST_MEMORY;
|
||||
#else
|
||||
slot->slotLock = NULL;
|
||||
slot->sessionLock = PORT_ZNewArray(PZLock *, slot->numSessionLocks);
|
||||
if (slot->sessionLock == NULL)
|
||||
goto mem_loser;
|
||||
slot->sessionLock = (PZLock **)
|
||||
PORT_ZAlloc(slot->numSessionLocks * sizeof(PZLock *));
|
||||
if (slot->sessionLock == NULL) {
|
||||
return CKR_HOST_MEMORY;
|
||||
}
|
||||
for (i=0; i < slot->numSessionLocks; i++) {
|
||||
slot->sessionLock[i] = NULL;
|
||||
}
|
||||
slot->objectLock = NULL;
|
||||
#endif
|
||||
slot->head = PORT_ZNewArray(PK11Session *, slot->sessHashSize);
|
||||
if (slot->head == NULL)
|
||||
goto mem_loser;
|
||||
slot->tokObjects = PORT_ZNewArray(PK11Object *, slot->tokObjHashSize);
|
||||
if (slot->tokObjects == NULL)
|
||||
goto mem_loser;
|
||||
slot->head = (PK11Session **)
|
||||
PORT_ZAlloc(slot->sessHashSize*sizeof(PK11Session *));
|
||||
if (slot->head == NULL) {
|
||||
return CKR_HOST_MEMORY;
|
||||
}
|
||||
slot->tokObjects = (PK11Object **)
|
||||
PORT_ZAlloc(slot->tokObjHashSize*sizeof(PK11Object *));
|
||||
if (slot->tokObjects == NULL) {
|
||||
return CKR_HOST_MEMORY;
|
||||
}
|
||||
slot->tokenHashTable = PL_NewHashTable(64,pk11_HashNumber,PL_CompareValues,
|
||||
SECITEM_HashCompare, NULL, 0);
|
||||
if (slot->tokenHashTable == NULL)
|
||||
goto mem_loser;
|
||||
|
||||
if (slot->tokenHashTable == NULL) {
|
||||
return CKR_HOST_MEMORY;
|
||||
}
|
||||
slot->password = NULL;
|
||||
slot->hasTokens = PR_FALSE;
|
||||
slot->sessionIDCount = 0;
|
||||
|
@ -2551,7 +2555,8 @@ PK11_SlotInit(char *configdir,pk11_token_parameters *params, int moduleIndex)
|
|||
params->noCertDB, params->noKeyDB, params->forceOpen,
|
||||
&slot->certDB, &slot->keyDB);
|
||||
if (crv != CKR_OK) {
|
||||
goto loser;
|
||||
/* shoutdown slot? */
|
||||
return crv;
|
||||
}
|
||||
|
||||
if (nsslowcert_needDBVerify(slot->certDB)) {
|
||||
|
@ -2571,13 +2576,6 @@ PK11_SlotInit(char *configdir,pk11_token_parameters *params, int moduleIndex)
|
|||
}
|
||||
}
|
||||
return CKR_OK;
|
||||
|
||||
mem_loser:
|
||||
crv = CKR_HOST_MEMORY;
|
||||
loser:
|
||||
/* cleanup partially created SlotData */
|
||||
pk11_DestroySlotData(slot);
|
||||
return crv;
|
||||
}
|
||||
|
||||
static PRIntn
|
||||
|
|
Загрузка…
Ссылка в новой задаче