| OLD | NEW |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 /* | 4 /* |
| 5 * Initialize the PCKS 11 subsystem | 5 * Initialize the PCKS 11 subsystem |
| 6 */ | 6 */ |
| 7 #include "seccomon.h" | 7 #include "seccomon.h" |
| 8 #include "secmod.h" | 8 #include "secmod.h" |
| 9 #include "nssilock.h" | 9 #include "nssilock.h" |
| 10 #include "secmodi.h" | 10 #include "secmodi.h" |
| 11 #include "secmodti.h" | 11 #include "secmodti.h" |
| 12 #include "pk11func.h" | 12 #include "pk11func.h" |
| 13 #include "pki3hack.h" | 13 #include "pki3hack.h" |
| 14 #include "secerr.h" | 14 #include "secerr.h" |
| 15 #include "dev.h" | 15 #include "dev.h" |
| 16 #include "pkcs11ni.h" | 16 #include "pkcs11ni.h" |
| 17 #include "utilpars.h" |
| 17 | 18 |
| 18 /* these are for displaying error messages */ | 19 /* these are for displaying error messages */ |
| 19 | 20 |
| 20 static SECMODModuleList *modules = NULL; | 21 static SECMODModuleList *modules = NULL; |
| 21 static SECMODModuleList *modulesDB = NULL; | 22 static SECMODModuleList *modulesDB = NULL; |
| 22 static SECMODModuleList *modulesUnload = NULL; | 23 static SECMODModuleList *modulesUnload = NULL; |
| 23 static SECMODModule *internalModule = NULL; | 24 static SECMODModule *internalModule = NULL; |
| 24 static SECMODModule *defaultDBModule = NULL; | 25 static SECMODModule *defaultDBModule = NULL; |
| 25 static SECMODModule *pendingModule = NULL; | 26 static SECMODModule *pendingModule = NULL; |
| 26 static SECMODListLock *moduleLock = NULL; | 27 static SECMODListLock *moduleLock = NULL; |
| (...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 return NULL; | 1365 return NULL; |
| 1365 } | 1366 } |
| 1366 | 1367 |
| 1367 /* just grab the first slot in the module, any present slot should work */ | 1368 /* just grab the first slot in the module, any present slot should work */ |
| 1368 slot = PK11_ReferenceSlot(mod->slots[0]); | 1369 slot = PK11_ReferenceSlot(mod->slots[0]); |
| 1369 if (slot == NULL) { | 1370 if (slot == NULL) { |
| 1370 return NULL; | 1371 return NULL; |
| 1371 } | 1372 } |
| 1372 | 1373 |
| 1373 /* we've found the slot, now build the moduleSpec */ | 1374 /* we've found the slot, now build the moduleSpec */ |
| 1374 escSpec = secmod_DoubleEscape(moduleSpec, '>', ']'); | 1375 escSpec = NSSUTIL_DoubleEscape(moduleSpec, '>', ']'); |
| 1375 if (escSpec == NULL) { | 1376 if (escSpec == NULL) { |
| 1376 PK11_FreeSlot(slot); | 1377 PK11_FreeSlot(slot); |
| 1377 return NULL; | 1378 return NULL; |
| 1378 } | 1379 } |
| 1379 sendSpec = PR_smprintf("tokens=[0x%x=<%s>]", slotID, escSpec); | 1380 sendSpec = PR_smprintf("tokens=[0x%x=<%s>]", slotID, escSpec); |
| 1380 PORT_Free(escSpec); | 1381 PORT_Free(escSpec); |
| 1381 | 1382 |
| 1382 if (sendSpec == NULL) { | 1383 if (sendSpec == NULL) { |
| 1383 /* PR_smprintf does not set SEC_ERROR_NO_MEMORY on failure. */ | 1384 /* PR_smprintf does not set SEC_ERROR_NO_MEMORY on failure. */ |
| 1384 PK11_FreeSlot(slot); | 1385 PK11_FreeSlot(slot); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 * on multiple failures, we are only returning the lastError. The caller | 1560 * on multiple failures, we are only returning the lastError. The caller |
| 1560 * can determine which slots are bad by calling PK11_IsDisabled(). | 1561 * can determine which slots are bad by calling PK11_IsDisabled(). |
| 1561 */ | 1562 */ |
| 1562 if (rrv != SECSuccess) { | 1563 if (rrv != SECSuccess) { |
| 1563 /* restore the last error code */ | 1564 /* restore the last error code */ |
| 1564 PORT_SetError(lastError); | 1565 PORT_SetError(lastError); |
| 1565 } | 1566 } |
| 1566 | 1567 |
| 1567 return rrv; | 1568 return rrv; |
| 1568 } | 1569 } |
| OLD | NEW |