Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IFDStatusICC returns SCARD_S_SUCCESS after the reader is removed #92

Closed
andrei-datcu opened this issue Dec 4, 2021 · 7 comments
Closed
Assignees
Labels

Comments

@andrei-datcu
Copy link

andrei-datcu commented Dec 4, 2021

Ever since this patch IFDStatusICC returns SCARD_S_SUCESS if the read fails. That's because IFDHICCPresence doesn't return IFD_NO_SUCH_DEVICE anymore. Upon a static code inspection, this means that nobody will ever set SCARD_UNKNOWN because the status handler thread get a success from IFDStatusICC

@LudovicRousseau
Copy link
Owner

I can't find SCARD_UKNOWN in the source code.

What is the problem exactly?

@andrei-datcu
Copy link
Author

Sorry, it was a typo: SCARD_UNKNOWN. Edited.

Basically a waiter for SCardGetStatus will not get a result when the reader is removed

@LudovicRousseau
Copy link
Owner

SCardGetStatusChange() instead SCardGetStatus()?

Have you tried to reproduce the bug with a sample code?

@LudovicRousseau LudovicRousseau self-assigned this May 29, 2022
@LudovicRousseau
Copy link
Owner

@andrei-datcu any news about this problem?

@andrei-datcu
Copy link
Author

Sorry, no repro on hand, but please allow me to expand on the static analysis:

Ever since this change, IFDHICCPresence will not return IFD_NO_SUCH_DEVICE.

This means that this code is now dead and no longer executes.
Finally, the event thread which sits at the bottom of this call stack will get a SCARD_S_SUCCESS and the status a SCARD_ABSENT flag. Up until the aforementioned patch, the thread would get a SCARD_E_READER_UNAVAILABLE and the status would be SCARD_UNKNOWN.

@LudovicRousseau
Copy link
Owner

I guess you are right.

What is the problem at the PC/SC API level? Do you have a sample code to show this problem?

@LudovicRousseau
Copy link
Owner

The code https://github.com/LudovicRousseau/PCSC/blob/210efa525f50e99821a10d91b8c861825e470d8b/src/ifdwrapper.c#L369 is not used only when you use the CCID driver. Other drivers may still report IFD_NO_SUCH_DEVICE when the reader is removed.

Unless you can show a real PC/SC application sample code with a problem I consider this as a non-issue and close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants