Skip to content

Commit

Permalink
slot: remove relation between reader and slot
Browse files Browse the repository at this point in the history
The card_detect() can detect removed reader,
it calls card_removed(), but card_detect_all()
did not remove relation between slot and reader.
  • Loading branch information
xhanulik committed Jun 15, 2023
1 parent 0d031d9 commit 4e46641
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/pkcs11/slot.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,17 @@ card_detect_all(void)
}
}
card_detect(reader);

/* If reader was removed, card_removed() was already called in card_detect(),
* remove only relation between reader and slot. */
if (reader->flags & SC_READER_REMOVED) {
for (j = 0; j<list_size(&virtual_slots); j++) {
sc_pkcs11_slot_t *slot = (sc_pkcs11_slot_t *) list_get_at(&virtual_slots, j);
if (slot->reader == reader) {
slot->reader = NULL;
}
}
}
}
}
sc_log(context, "All cards detected");
Expand Down

0 comments on commit 4e46641

Please sign in to comment.