diff options
author | Ray Strode <rstrode@redhat.com> | 2014-10-18 22:12:47 -0400 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-10-28 11:38:18 +0100 |
commit | f032cfab6158e981a6ea0c369c5366e654e668a6 (patch) | |
tree | 86e79aed67d77810435aeb40ad56e73dc67544af /libcacard/vcard_emul_nss.c | |
parent | 3e9418e160cd8901c83a3c88967158084f5b5c03 (diff) |
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>
Diffstat (limited to 'libcacard/vcard_emul_nss.c')
-rw-r--r-- | libcacard/vcard_emul_nss.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c index 07b446481e..950edee069 100644 --- a/libcacard/vcard_emul_nss.c +++ b/libcacard/vcard_emul_nss.c @@ -401,7 +401,7 @@ vcard_emul_login(VCard *card, unsigned char *pin, int pin_len) } void -vcard_emul_reset(VCard *card, VCardPower power) +vcard_emul_logout(VCard *card) { PK11SlotInfo *slot; @@ -409,16 +409,24 @@ vcard_emul_reset(VCard *card, VCardPower power) 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 * state */ + vcard_emul_logout(card); + /* TODO: we may also need to send insertion/removal events? */ - slot = vcard_emul_card_get_slot(card); - PK11_Logout(slot); /* NOTE: ignoring SECStatus return value */ } - static VReader * vcard_emul_find_vreader_from_slot(PK11SlotInfo *slot) { |