Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep track of card resets by other contexts in minidriver
Most of the cards supported by OpenSC do not support the "logout" method required to deauthenticate a card. This means that the only way to deauthenticate the card without removing it from reader is to reset it. This is done by Base CSP if we return SCARD_E_UNSUPPORTED_FEATURE from CardDeauthenticate() in minidriver, which we do if calling "logout" card method fails. If this happens, all users of this card will lose its state and at least some cards (OpenPGP card and cards having multiple applets) will be non-functional in currently active minidriver contexts as they need some initialization after reset. This makes it really hard to use card from multiple applications as some Windows libraries (like WinHTTP used by IE and WebDAV client) prefer to deauthenticate card after only a few seconds of inactivity (with PIN cached for future operations). Keep a list (critical section protected) of other minidriver contexts which are using this reader (and so this card) to make sure all of them will be reinitialized after the card is reset by Base CSP or some other user. There are other reasons (like card handles changed) where a card needs to be reinitialized, too. This solution isn't most optimal possible, but at least makes these cards work properly - for more detailed discussion about card reset issue please have a look at description of commit "Provide notification about and handle card resets by other contexts". Signed-off-by: Maciej S. Szmigiero <[email protected]>
- Loading branch information