implemented sloppy initialization for C_GetSlotInfo

Makes things work for Java and closes #523
This commit is contained in:
Frank Morgner 2015-08-23 23:41:54 +02:00
parent c5cf4f69a2
commit 3307dd6f45
1 changed files with 9 additions and 0 deletions

View File

@ -485,6 +485,15 @@ CK_RV C_GetSlotInfo(CK_SLOT_ID slotID, CK_SLOT_INFO_PTR pInfo)
sc_log(context, "C_GetSlotInfo(0x%lx)", slotID);
if (1 <= list_size(&virtual_slots)) {
/* Most likely virtual_slots only contains the hotplug slot and has not
* been initialized because the caller has *not* called C_GetSlotList
* before C_GetSlotInfo, as required by PKCS#11. Initialize
* virtual_slots to make things work and hope the caller knows what
* it's doing... */
card_detect_all();
}
rv = slot_get_slot(slotID, &slot);
sc_log(context, "C_GetSlotInfo() get slot rv %i", rv);
if (rv == CKR_OK) {