Commit 54224a4c authored by Ludovic Rousseau's avatar Ludovic Rousseau

Fix SCardGetStatusChange() broken in a previous patch 984f84df

The patch in 984f84df broke the
execution of SCardGetStatusChange() when SCardCancel() is used.

The client was waiting for a message that was never sent by the server.

Fortunately the broken code was never released in a stable version of
pcsc-lite.

Thanks to Sam Van Den Berge for the bug report
"[Pcsclite-muscle] SCardCancel broken"
http://lists.infradead.org/pipermail/pcsclite-muscle/2018-July/001096.html

Hello,

It seems like SCardGetStatusChange is currently broken.
This can be tested with UnitaryTests/SCardCancel.

Before commit 984f84df:

$ LD_LIBRARY_PATH=../src/.libs/ ./SCardCancel
SCardEstablishContext:[0x00000000] Command successful.
Press Enter to cancel within 3 seconds
Entering blocking call

Calling SCardCancel...
SCardGetStatusChange:[0x80100002] Command cancelled.
Blocking call canceled
Good
SCardCancel:[0x00000000] Command successful.
SCardReleaseContext:[0x00000000] Command successful.
Waiting thread...

After commit 984f84df:

$ LD_LIBRARY_PATH=../src/.libs/ ./SCardCancel
SCardEstablishContext:[0x00000000] Command successful.
Press Enter to cancel within 3 seconds
Entering blocking call

Calling SCardCancel...
SCardCancel:[0x00000000] Command successful.

<<<<<<<<< SCardGetStatusChange hangs here >>>>>>>>>

I don't have a fix but I just wanted to report this. Besides this big
thank you for all your great work!

Kr,
Sam.
parent ddf72587
......@@ -2129,7 +2129,10 @@ LONG SCardGetStatusChange(SCARDCONTEXT hContext, DWORD dwTimeout,
end:
Log1(PCSC_LOG_DEBUG, "Event Loop End");
(void)unregisterFromEvents(currentContextMap);
/* if SCardCancel() has been used then the client is already
* unregistered */
if (SCARD_E_CANCELLED != rv)
(void)unregisterFromEvents(currentContextMap);
(void)pthread_mutex_unlock(&currentContextMap->mMutex);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment