| 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 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 slot->flagSeries = series; | 1075 slot->flagSeries = series; |
| 1076 SECMOD_ReleaseReadLock(moduleLock); | 1076 SECMOD_ReleaseReadLock(moduleLock); |
| 1077 PZ_Lock(mod->refLock); | 1077 PZ_Lock(mod->refLock); |
| 1078 mod->evControlMask &= ~SECMOD_END_WAIT; | 1078 mod->evControlMask &= ~SECMOD_END_WAIT; |
| 1079 PZ_Unlock(mod->refLock); | 1079 PZ_Unlock(mod->refLock); |
| 1080 return PK11_ReferenceSlot(slot); | 1080 return PK11_ReferenceSlot(slot); |
| 1081 } | 1081 } |
| 1082 } | 1082 } |
| 1083 SECMOD_ReleaseReadLock(moduleLock); | 1083 SECMOD_ReleaseReadLock(moduleLock); |
| 1084 /* if everything was perm modules, don't lock up forever */ | 1084 /* if everything was perm modules, don't lock up forever */ |
| 1085 » if (!removableSlotsFound) { | 1085 » if ((mod->slotCount !=0) && !removableSlotsFound) { |
| 1086 error =SEC_ERROR_NO_SLOT_SELECTED; | 1086 error =SEC_ERROR_NO_SLOT_SELECTED; |
| 1087 PZ_Lock(mod->refLock); | 1087 PZ_Lock(mod->refLock); |
| 1088 break; | 1088 break; |
| 1089 } | 1089 } |
| 1090 if (flags & CKF_DONT_BLOCK) { | 1090 if (flags & CKF_DONT_BLOCK) { |
| 1091 PZ_Lock(mod->refLock); | 1091 PZ_Lock(mod->refLock); |
| 1092 break; | 1092 break; |
| 1093 } | 1093 } |
| 1094 PR_Sleep(latency); | 1094 PR_Sleep(latency); |
| 1095 PZ_Lock(mod->refLock); | 1095 PZ_Lock(mod->refLock); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 SECMOD_GetReadLock(moduleLock); | 1244 SECMOD_GetReadLock(moduleLock); |
| 1245 for (i=0; i < mod->slotCount; i++) { | 1245 for (i=0; i < mod->slotCount; i++) { |
| 1246 PK11SlotInfo *slot = mod->slots[i]; | 1246 PK11SlotInfo *slot = mod->slots[i]; |
| 1247 /* perm modules are not inserted or removed */ | 1247 /* perm modules are not inserted or removed */ |
| 1248 if (slot->isPerm) { | 1248 if (slot->isPerm) { |
| 1249 continue; | 1249 continue; |
| 1250 } | 1250 } |
| 1251 ret = PR_TRUE; | 1251 ret = PR_TRUE; |
| 1252 break; | 1252 break; |
| 1253 } | 1253 } |
| 1254 if (mod->slotCount == 0 ) { |
| 1255 ret = PR_TRUE; |
| 1256 } |
| 1254 SECMOD_ReleaseReadLock(moduleLock); | 1257 SECMOD_ReleaseReadLock(moduleLock); |
| 1255 return ret; | 1258 return ret; |
| 1256 } | 1259 } |
| 1257 | 1260 |
| 1258 /* | 1261 /* |
| 1259 * helper function to actually create and destroy user defined slots | 1262 * helper function to actually create and destroy user defined slots |
| 1260 */ | 1263 */ |
| 1261 static SECStatus | 1264 static SECStatus |
| 1262 secmod_UserDBOp(PK11SlotInfo *slot, CK_OBJECT_CLASS objClass, | 1265 secmod_UserDBOp(PK11SlotInfo *slot, CK_OBJECT_CLASS objClass, |
| 1263 const char *sendSpec) | 1266 const char *sendSpec) |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 * on multiple failures, we are only returning the lastError. The caller | 1559 * on multiple failures, we are only returning the lastError. The caller |
| 1557 * can determine which slots are bad by calling PK11_IsDisabled(). | 1560 * can determine which slots are bad by calling PK11_IsDisabled(). |
| 1558 */ | 1561 */ |
| 1559 if (rrv != SECSuccess) { | 1562 if (rrv != SECSuccess) { |
| 1560 /* restore the last error code */ | 1563 /* restore the last error code */ |
| 1561 PORT_SetError(lastError); | 1564 PORT_SetError(lastError); |
| 1562 } | 1565 } |
| 1563 | 1566 |
| 1564 return rrv; | 1567 return rrv; |
| 1565 } | 1568 } |
| OLD | NEW |