After looking farther into the problem of crashing when no card was present at all, it appears to come from a side-effect of MSCListTokens, which will create a localHContext. The calling function (in this case, the MusclePAM utility pcsc_init) calls it, sees a list of length zero returned, then just returns, but the connection to pcscd is never closed. Had that call succeeded, then the MusclePAM would have gone on to call MSCEstablishConnection, so it then knows enough to balance it with a MSCReleaseConnection, which would have closed the local context.
The simplest solution would seem to be closing the local context before returning from MSCListTokens. Alternatively, some sort of start/stop functions for the pcsc library as a whole, before the calling application knows to which token it wants to attach? (Myself, I like the first solution more.) As an even better solution, could we have a cleanup function called by the _fini(void) to release localHContext? I don't see any use of _fini in the libpcsclite.so so far, so I'm not sure how to fit it in with the existing programming style. (And I really don't know how to get the automake to generate a compile with "-nostartfiles" on the linking command line.) Cheers, -- Mike. ----------------------------------------------------------------------- Michael Nidd IBM Zurich Research Laboratory Saumerstrasse 4 CH-8803 Rueschlikon/Switzerland [EMAIL PROTECTED] Tel: +41-1-724-89-30 Fax: +41-1-724-89-53 What you want, what you're hanging around in the world waiting for, is for something to occur to you. -- Robert Frost _______________________________________________ Muscle mailing list [EMAIL PROTECTED] http://lists.musclecard.com/mailman/listinfo/muscle
