Add calls to DEBUG_VSS
On branch PKCS11-SLOTS-2 Changes to be committed: modified: pkcs11-global.c modified: slot.c
This commit is contained in:
parent
2e89f1634f
commit
8d519ed3c4
@ -449,13 +449,18 @@ CK_RV C_GetSlotList(CK_BBOOL tokenPresent, /* only slots with token prese
|
||||
|
||||
sc_log(context, "C_GetSlotList(token=%d, %s)", tokenPresent,
|
||||
pSlotList==NULL_PTR? "plug-n-play":"refresh");
|
||||
DEBUG_VSS(NULL, "C_GetSlotList before ctx_detect_detect");
|
||||
|
||||
/* Slot list can only change in v2.20 */
|
||||
if (pSlotList == NULL_PTR)
|
||||
sc_ctx_detect_readers(context);
|
||||
|
||||
DEBUG_VSS(NULL, "C_GetSlotList after ctx_detect_readers");
|
||||
|
||||
card_detect_all();
|
||||
|
||||
DEBUG_VSS(NULL, "C_GetSlotList after card_detect_all");
|
||||
|
||||
found = calloc(list_size(&virtual_slots), sizeof(CK_SLOT_ID));
|
||||
|
||||
if (found == NULL) {
|
||||
@ -479,6 +484,7 @@ CK_RV C_GetSlotList(CK_BBOOL tokenPresent, /* only slots with token prese
|
||||
}
|
||||
prev_reader = slot->reader;
|
||||
}
|
||||
DEBUG_VSS(NULL, "C_GetSlotList after card_detect_all");
|
||||
|
||||
if (pSlotList == NULL_PTR) {
|
||||
sc_log(context, "was only a size inquiry (%lu)\n", numMatches);
|
||||
@ -486,6 +492,7 @@ CK_RV C_GetSlotList(CK_BBOOL tokenPresent, /* only slots with token prese
|
||||
rv = CKR_OK;
|
||||
goto out;
|
||||
}
|
||||
DEBUG_VSS(NULL, "C_GetSlotList after slot->id reassigned");
|
||||
|
||||
if (*pulCount < numMatches) {
|
||||
sc_log(context, "buffer was too small (needed %lu)\n", numMatches);
|
||||
@ -499,6 +506,7 @@ CK_RV C_GetSlotList(CK_BBOOL tokenPresent, /* only slots with token prese
|
||||
rv = CKR_OK;
|
||||
|
||||
sc_log(context, "returned %lu slots\n", numMatches);
|
||||
DEBUG_VSS(NULL, "Returning a new slot list");
|
||||
|
||||
out:
|
||||
free (found);
|
||||
@ -535,7 +543,7 @@ static sc_timestamp_t get_current_time(void)
|
||||
|
||||
CK_RV C_GetSlotInfo(CK_SLOT_ID slotID, CK_SLOT_INFO_PTR pInfo)
|
||||
{
|
||||
struct sc_pkcs11_slot *slot;
|
||||
struct sc_pkcs11_slot *slot = NULL;
|
||||
sc_timestamp_t now;
|
||||
CK_RV rv;
|
||||
|
||||
@ -558,6 +566,7 @@ CK_RV C_GetSlotInfo(CK_SLOT_ID slotID, CK_SLOT_INFO_PTR pInfo)
|
||||
}
|
||||
|
||||
rv = slot_get_slot(slotID, &slot);
|
||||
DEBUG_VSS(slot, "C_GetSlotInfo found");
|
||||
sc_log(context, "C_GetSlotInfo() get slot rv %s", lookup_enum( RV_T, rv));
|
||||
if (rv == CKR_OK) {
|
||||
if (slot->reader == NULL) {
|
||||
|
@ -75,7 +75,8 @@ static struct sc_pkcs11_slot * reader_reclaim_slot(sc_reader_t *reader)
|
||||
/* Locate a slot related to the reader */
|
||||
for (i = 0; i<list_size(&virtual_slots); i++) {
|
||||
sc_pkcs11_slot_t *slot = (sc_pkcs11_slot_t *) list_get_at(&virtual_slots, i);
|
||||
if (slot->reader == reader)
|
||||
if (slot->reader == reader) {
|
||||
DEBUG_VSS(slot, "reader_get_slot found slot");
|
||||
return slot;
|
||||
if (slot->reader == NULL && reader != NULL
|
||||
&& 0 == memcmp(slot->slot_info.slotDescription, slotDescription, 64)
|
||||
@ -83,6 +84,7 @@ static struct sc_pkcs11_slot * reader_reclaim_slot(sc_reader_t *reader)
|
||||
&& slot->slot_info.hardwareVersion.major == reader->version_major
|
||||
&& slot->slot_info.hardwareVersion.minor == reader->version_minor)
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -140,6 +142,7 @@ CK_RV create_slot(sc_reader_t *reader)
|
||||
if (0 != list_init(&slot->logins)) {
|
||||
return CKR_HOST_MEMORY;
|
||||
}
|
||||
DEBUG_VSS(slot, "Creating new slot");
|
||||
} else {
|
||||
/* reuse the old list of logins/objects since they should be empty */
|
||||
list_t logins = slot->logins;
|
||||
@ -149,6 +152,7 @@ CK_RV create_slot(sc_reader_t *reader)
|
||||
|
||||
slot->logins = logins;
|
||||
slot->objects = objects;
|
||||
DEBUG_VSS(slot, "Reusing old slot");
|
||||
}
|
||||
|
||||
slot->login_user = -1;
|
||||
@ -159,6 +163,7 @@ CK_RV create_slot(sc_reader_t *reader)
|
||||
if (reader != NULL) {
|
||||
slot->reader = reader;
|
||||
}
|
||||
DEBUG_VSS(slot, "Created this slot");
|
||||
|
||||
return CKR_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user