libcacard: introduce new vcard_emul_logout
vcard_emul_reset currently only logs NSS out, but there is a TODO for potentially sending insertion/removal events when powering down or powering up. For clarity, this commit moves the current guts of vcard_emul_reset to a new vcard_emul_logout function which will never send insertion/removal events. The vcard_emul_reset function now just calls vcard_emul_logout, but also retains its TODO for watching power state transitions and sending insertion/removal events. Signed-off-by: Ray Strode <rstrode@redhat.com> Reviewed-By: Robert Relyea <rrelyea@redhat.com> Reviewed-By: Alon Levy <alevy@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
3e9418e160
commit
f032cfab61
@ -40,6 +40,7 @@ int vcard_emul_get_login_count(VCard *card);
|
|||||||
/* login into the card, return the 7816 status word (sw2 || sw1) */
|
/* login into the card, return the 7816 status word (sw2 || sw1) */
|
||||||
vcard_7816_status_t vcard_emul_login(VCard *card, unsigned char *pin,
|
vcard_7816_status_t vcard_emul_login(VCard *card, unsigned char *pin,
|
||||||
int pin_len);
|
int pin_len);
|
||||||
|
void vcard_emul_logout(VCard *card);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* key functions
|
* key functions
|
||||||
|
@ -401,7 +401,7 @@ vcard_emul_login(VCard *card, unsigned char *pin, int pin_len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vcard_emul_reset(VCard *card, VCardPower power)
|
vcard_emul_logout(VCard *card)
|
||||||
{
|
{
|
||||||
PK11SlotInfo *slot;
|
PK11SlotInfo *slot;
|
||||||
|
|
||||||
@ -409,15 +409,23 @@ vcard_emul_reset(VCard *card, VCardPower power)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slot = vcard_emul_card_get_slot(card);
|
||||||
|
if (PK11_IsLoggedIn(slot, NULL)) {
|
||||||
|
PK11_Logout(slot); /* NOTE: ignoring SECStatus return value */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
vcard_emul_reset(VCard *card, VCardPower power)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* if we reset the card (either power on or power off), we lose our login
|
* if we reset the card (either power on or power off), we lose our login
|
||||||
* state
|
* state
|
||||||
*/
|
*/
|
||||||
/* TODO: we may also need to send insertion/removal events? */
|
vcard_emul_logout(card);
|
||||||
slot = vcard_emul_card_get_slot(card);
|
|
||||||
PK11_Logout(slot); /* NOTE: ignoring SECStatus return value */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* TODO: we may also need to send insertion/removal events? */
|
||||||
|
}
|
||||||
|
|
||||||
static VReader *
|
static VReader *
|
||||||
vcard_emul_find_vreader_from_slot(PK11SlotInfo *slot)
|
vcard_emul_find_vreader_from_slot(PK11SlotInfo *slot)
|
||||||
|
Loading…
Reference in New Issue
Block a user