Hello,

the 'hide_empty_slot' configuration option seems to not working.

Here is the patch that works for me.

Any objections?


Kind wishes,
Viktor.


Index: src/pkcs11/pkcs11-global.c
===================================================================
--- src/pkcs11/pkcs11-global.c  (révision 5411)
+++ src/pkcs11/pkcs11-global.c  (copie de travail)
@@ -361,6 +361,7 @@
        unsigned int i;
        CK_ULONG numMatches;
        sc_pkcs11_slot_t *slot;
+       sc_reader_t *prev_reader = NULL;
        CK_RV rv;
 
        if (pulCount == NULL_PTR)
@@ -390,11 +391,18 @@
                goto out;
        }
 
+       prev_reader = NULL;
        numMatches = 0;
        for (i=0; i<list_size(&virtual_slots); i++) {
                slot = (sc_pkcs11_slot_t *) list_get_at(&virtual_slots, i);
-               if (!tokenPresent || (slot->slot_info.flags & 
CKF_TOKEN_PRESENT))
+               /* the list of available slots contains:
+                * - if present, virtual hotplug slot;
+                * - without token(s), one empty slot per reader;
+                * - any slot with token.
+                */
+               if (!slot->reader || (!tokenPresent && slot->reader != 
prev_reader) || (slot->slot_info.flags & CKF_TOKEN_PRESENT))
                        found[numMatches++] = slot->id;
+               prev_reader = slot->reader;
        }
 
        if (pSlotList == NULL_PTR) {

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to