зеркало из 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* forward static declaration. */
|
|
||||||
static CK_RV pk11_DestroySlotData(PK11Slot *slot);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initialize one of the slot structures. figure out which by the ID
|
* 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
|
#ifdef PKCS11_USE_THREADS
|
||||||
slot->slotLock = PZ_NewLock(nssILockSession);
|
slot->slotLock = PZ_NewLock(nssILockSession);
|
||||||
if (slot->slotLock == NULL)
|
if (slot->slotLock == NULL) {
|
||||||
goto mem_loser;
|
return CKR_HOST_MEMORY;
|
||||||
slot->sessionLock = PORT_ZNewArray(PZLock *, slot->numSessionLocks);
|
}
|
||||||
if (slot->sessionLock == NULL)
|
slot->sessionLock = (PZLock **)
|
||||||
goto mem_loser;
|
PORT_ZAlloc(slot->numSessionLocks * sizeof(PZLock *));
|
||||||
|
if (slot->sessionLock == NULL) {
|
||||||
|
return CKR_HOST_MEMORY;
|
||||||
|
}
|
||||||
for (i=0; i < slot->numSessionLocks; i++) {
|
for (i=0; i < slot->numSessionLocks; i++) {
|
||||||
slot->sessionLock[i] = PZ_NewLock(nssILockSession);
|
slot->sessionLock[i] = PZ_NewLock(nssILockSession);
|
||||||
if (slot->sessionLock[i] == NULL)
|
if (slot->sessionLock[i] == NULL) return CKR_HOST_MEMORY;
|
||||||
goto mem_loser;
|
|
||||||
}
|
}
|
||||||
slot->objectLock = PZ_NewLock(nssILockObject);
|
slot->objectLock = PZ_NewLock(nssILockObject);
|
||||||
if (slot->objectLock == NULL)
|
if (slot->objectLock == NULL) return CKR_HOST_MEMORY;
|
||||||
goto mem_loser;
|
|
||||||
#else
|
#else
|
||||||
slot->slotLock = NULL;
|
slot->slotLock = NULL;
|
||||||
slot->sessionLock = PORT_ZNewArray(PZLock *, slot->numSessionLocks);
|
slot->sessionLock = (PZLock **)
|
||||||
if (slot->sessionLock == NULL)
|
PORT_ZAlloc(slot->numSessionLocks * sizeof(PZLock *));
|
||||||
goto mem_loser;
|
if (slot->sessionLock == NULL) {
|
||||||
|
return CKR_HOST_MEMORY;
|
||||||
|
}
|
||||||
for (i=0; i < slot->numSessionLocks; i++) {
|
for (i=0; i < slot->numSessionLocks; i++) {
|
||||||
slot->sessionLock[i] = NULL;
|
slot->sessionLock[i] = NULL;
|
||||||
}
|
}
|
||||||
slot->objectLock = NULL;
|
slot->objectLock = NULL;
|
||||||
#endif
|
#endif
|
||||||
slot->head = PORT_ZNewArray(PK11Session *, slot->sessHashSize);
|
slot->head = (PK11Session **)
|
||||||
if (slot->head == NULL)
|
PORT_ZAlloc(slot->sessHashSize*sizeof(PK11Session *));
|
||||||
goto mem_loser;
|
if (slot->head == NULL) {
|
||||||
slot->tokObjects = PORT_ZNewArray(PK11Object *, slot->tokObjHashSize);
|
return CKR_HOST_MEMORY;
|
||||||
if (slot->tokObjects == NULL)
|
}
|
||||||
goto mem_loser;
|
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,
|
slot->tokenHashTable = PL_NewHashTable(64,pk11_HashNumber,PL_CompareValues,
|
||||||
SECITEM_HashCompare, NULL, 0);
|
SECITEM_HashCompare, NULL, 0);
|
||||||
if (slot->tokenHashTable == NULL)
|
if (slot->tokenHashTable == NULL) {
|
||||||
goto mem_loser;
|
return CKR_HOST_MEMORY;
|
||||||
|
}
|
||||||
slot->password = NULL;
|
slot->password = NULL;
|
||||||
slot->hasTokens = PR_FALSE;
|
slot->hasTokens = PR_FALSE;
|
||||||
slot->sessionIDCount = 0;
|
slot->sessionIDCount = 0;
|
||||||
|
@ -2551,7 +2555,8 @@ PK11_SlotInit(char *configdir,pk11_token_parameters *params, int moduleIndex)
|
||||||
params->noCertDB, params->noKeyDB, params->forceOpen,
|
params->noCertDB, params->noKeyDB, params->forceOpen,
|
||||||
&slot->certDB, &slot->keyDB);
|
&slot->certDB, &slot->keyDB);
|
||||||
if (crv != CKR_OK) {
|
if (crv != CKR_OK) {
|
||||||
goto loser;
|
/* shoutdown slot? */
|
||||||
|
return crv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsslowcert_needDBVerify(slot->certDB)) {
|
if (nsslowcert_needDBVerify(slot->certDB)) {
|
||||||
|
@ -2571,13 +2576,6 @@ PK11_SlotInit(char *configdir,pk11_token_parameters *params, int moduleIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CKR_OK;
|
return CKR_OK;
|
||||||
|
|
||||||
mem_loser:
|
|
||||||
crv = CKR_HOST_MEMORY;
|
|
||||||
loser:
|
|
||||||
/* cleanup partially created SlotData */
|
|
||||||
pk11_DestroySlotData(slot);
|
|
||||||
return crv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PRIntn
|
static PRIntn
|
||||||
|
|
Загрузка…
Ссылка в новой задаче