aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2012-03-22 19:58:58 +0200
committerAlon Levy <alevy@redhat.com>2012-03-26 18:39:00 +0200
commit4e339882362102da63ab060f952d249a99ab6752 (patch)
treebb1090243bef47555d0b6bd1ddf8a6919147b51f
parent1b902f7defa9f5229f92dfb32406c5b30c8045ab (diff)
libcacard/vcard_emul_nss: handle no readers at startup
When starting with no readers, coolkey should show no slots (with RHBZ 806038 fixed). Fix initialization to launch the event handling thread for each module that isn't the internal module regardless of the number of slots detected for it at initialization time, since slot number may start as 0 and is dynamic. RHBZ: 802435 Signed-off-by: Alon Levy <alevy@redhat.com>
-rw-r--r--libcacard/vcard_emul_nss.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c
index 7de5d5b5a7..3703fdcbe9 100644
--- a/libcacard/vcard_emul_nss.c
+++ b/libcacard/vcard_emul_nss.c
@@ -1005,10 +1005,10 @@ vcard_emul_init(const VCardEmulOptions *options)
SECMOD_GetReadLock(module_lock);
for (mlp = module_list; mlp; mlp = mlp->next) {
SECMODModule *module = mlp->module;
- PRBool has_emul_slots = PR_FALSE;
- if (module == NULL) {
- continue;
+ /* Ignore the internal module */
+ if (module == NULL || module == SECMOD_GetInternalModule()) {
+ continue;
}
for (i = 0; i < module->slotCount; i++) {
@@ -1024,9 +1024,6 @@ vcard_emul_init(const VCardEmulOptions *options)
vreader_emul_delete);
vreader_add_reader(vreader);
- has_readers = PR_TRUE;
- has_emul_slots = PR_TRUE;
-
if (PK11_IsPresent(slot)) {
VCard *vcard;
vcard = vcard_emul_mirror_card(vreader);
@@ -1035,12 +1032,10 @@ vcard_emul_init(const VCardEmulOptions *options)
vcard_free(vcard);
}
}
- if (has_emul_slots) {
- vcard_emul_new_event_thread(module);
- }
+ vcard_emul_new_event_thread(module);
}
SECMOD_ReleaseReadLock(module_lock);
- nss_emul_init = has_readers;
+ nss_emul_init = PR_TRUE;
return VCARD_EMUL_OK;
}