On Thu, Oct 9, 2008 at 12:10 AM, Douglas E. Engert <[EMAIL PROTECTED]> wrote: > > > Ludovic Rousseau wrote: >> >> Hello, >> >> On Mon, Oct 6, 2008 at 8:48 PM, Douglas E. Engert <[EMAIL PROTECTED]> >> wrote: >>> >>> OpenSC will show a slot is present if there is a reader, but >>> will segfault if C_GetMechanismList is called for an unused >>> virtual slot. I submitted to OpenSC ticket number #181 >> >> You have not responded to my comment in the bug report [1] >> I think your patch is not the correct solution and that the real >> problem is elsewhere. > > After doing some debugging, I think I might see the problem. > > Virtual slots are created and cleared to zero. > Thus slot->reader = 0; > > As I understand it, virtual slots are assigned to a reader. > But the slot->reader is not set by card_initialize. > Thus all the extra slots appear to be for reader 0. > I only have one reader, but 8 virtual slots are the default, > with 4 slots per card/reader. > > While getting slot information for slot 4, > In slot.c, slot_get_token() calls > rv = card_detect(*(slot)->reader) > which returns 0, as there is a card in reader 0, > but it should be looking at reader 1. > Thus get_slot_token returns CKR_OK rather then > CKR_TOKEN_NOT_PRESENT for the slot 4. > > Attached is a possible solution. > This has some debugging and is not well tested.
Patch applied. Thanks. One strange thing is that C_GetTokenInfo(), C_GetMechanismList() does not return CKR_TOKEN_NOT_PRESENT for slots 1 to 3 even if the flag CKF_TOKEN_PRESENT is not set in C_GetSlotInfo() -- Dr. Ludovic Rousseau _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel