remove/insert fix: restore the slot->reader in slot_token_removed

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@943 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
sth 2003-03-07 14:18:55 +00:00
parent 4dd322f82a
commit ca6a27e429
1 changed files with 3 additions and 0 deletions

View File

@ -272,6 +272,7 @@ CK_RV slot_token_removed(int id)
struct sc_pkcs11_slot *slot;
struct sc_pkcs11_object *object;
CK_SLOT_INFO saved_slot_info;
int reader;
rv = slot_get_slot(id, &slot);
if (rv != CKR_OK)
@ -298,10 +299,12 @@ CK_RV slot_token_removed(int id)
/* Zap everything else. Restore the slot_info afterwards (it contains the reader
* name, for instance) but clear its flags */
saved_slot_info = slot->slot_info;
reader = slot->reader;
memset(slot, 0, sizeof(*slot));
slot->slot_info = saved_slot_info;
slot->slot_info.flags = 0;
slot->login_user = -1;
slot->reader = reader;
if (token_was_present)
slot->events = SC_EVENT_CARD_REMOVED;