| 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" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 SECMOD_DestroyModuleList(modulesUnload); | 77 SECMOD_DestroyModuleList(modulesUnload); |
| 78 modulesUnload = NULL; | 78 modulesUnload = NULL; |
| 79 } | 79 } |
| 80 | 80 |
| 81 /* make all the slots and the lists go away */ | 81 /* make all the slots and the lists go away */ |
| 82 PK11_DestroySlotLists(); | 82 PK11_DestroySlotLists(); |
| 83 | 83 |
| 84 nss_DumpModuleLog(); | 84 nss_DumpModuleLog(); |
| 85 | 85 |
| 86 #ifdef DEBUG | 86 #ifdef DEBUG |
| 87 if (PR_GetEnv("NSS_STRICT_SHUTDOWN")) { | 87 if (PR_GetEnvSecure("NSS_STRICT_SHUTDOWN")) { |
| 88 PORT_Assert(secmod_PrivateModuleCount == 0); | 88 PORT_Assert(secmod_PrivateModuleCount == 0); |
| 89 } | 89 } |
| 90 #endif | 90 #endif |
| 91 if (secmod_PrivateModuleCount) { | 91 if (secmod_PrivateModuleCount) { |
| 92 PORT_SetError(SEC_ERROR_BUSY); | 92 PORT_SetError(SEC_ERROR_BUSY); |
| 93 return SECFailure; | 93 return SECFailure; |
| 94 } | 94 } |
| 95 return SECSuccess; | 95 return SECSuccess; |
| 96 } | 96 } |
| 97 | 97 |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 for (s = 0; s < module->slotCount; s++) { | 633 for (s = 0; s < module->slotCount; s++) { |
| 634 slot = (module->slots)[s]; | 634 slot = (module->slots)[s]; |
| 635 /* for each possible mechanism */ | 635 /* for each possible mechanism */ |
| 636 for (i=0; i < num_pk11_default_mechanisms; i++) { | 636 for (i=0; i < num_pk11_default_mechanisms; i++) { |
| 637 /* we are told to turn it on by default ? */ | 637 /* we are told to turn it on by default ? */ |
| 638 PRBool add = | 638 PRBool add = |
| 639 (PK11_DefaultArray[i].flag & defaultMechanismFlags) ? | 639 (PK11_DefaultArray[i].flag & defaultMechanismFlags) ? |
| 640 PR_TRUE: PR_FALSE; | 640 PR_TRUE: PR_FALSE; |
| 641 result = PK11_UpdateSlotAttribute(slot, | 641 result = PK11_UpdateSlotAttribute(slot, |
| 642 &(PK11_DefaultArray[i]), add); | 642 &(PK11_DefaultArray[i]), add); |
| 643 if (result != SECSuccess) { |
| 644 SECMOD_ReleaseReadLock(moduleLock); |
| 645 SECMOD_DestroyModule(module); |
| 646 return result; |
| 647 } |
| 643 } /* for each mechanism */ | 648 } /* for each mechanism */ |
| 644 /* disable each slot if the defaultFlags say so */ | 649 /* disable each slot if the defaultFlags say so */ |
| 645 if (defaultMechanismFlags & PK11_DISABLE_FLAG) { | 650 if (defaultMechanismFlags & PK11_DISABLE_FLAG) { |
| 646 PK11_UserDisableSlot(slot); | 651 PK11_UserDisableSlot(slot); |
| 647 } | 652 } |
| 648 } /* for each slot of this module */ | 653 } /* for each slot of this module */ |
| 649 SECMOD_ReleaseReadLock(moduleLock); | 654 SECMOD_ReleaseReadLock(moduleLock); |
| 650 | 655 |
| 651 /* delete and re-add module in order to save changes | 656 /* delete and re-add module in order to save changes |
| 652 * to the module */ | 657 * to the module */ |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 * on multiple failures, we are only returning the lastError. The caller | 1581 * on multiple failures, we are only returning the lastError. The caller |
| 1577 * can determine which slots are bad by calling PK11_IsDisabled(). | 1582 * can determine which slots are bad by calling PK11_IsDisabled(). |
| 1578 */ | 1583 */ |
| 1579 if (rrv != SECSuccess) { | 1584 if (rrv != SECSuccess) { |
| 1580 /* restore the last error code */ | 1585 /* restore the last error code */ |
| 1581 PORT_SetError(lastError); | 1586 PORT_SetError(lastError); |
| 1582 } | 1587 } |
| 1583 | 1588 |
| 1584 return rrv; | 1589 return rrv; |
| 1585 } | 1590 } |
| OLD | NEW |