Hi,

I've already posted on the rdesktop-users list a description of my my issue, basically I cannot unlock a Windowx XP session with the smart card while it has been possible to lock it by removing the card.

Activating the debug trace we can observe an infinite loop:

(...)
SCARD: SCardGetStatusChange(context: 0x0103b068, timeout: 0x00000000, count: 1)
SCARD:    "Gemplus GemPC Twin 00 00"
SCARD:        user: 0x00000000, state: 0x00000120, event: 0x00000122
SCARD:            current state: 0x05ea0120
SCARD: -> Success
SCARD:    "Gemplus GemPC Twin 00 00"
SCARD:        user: 0x00000000, state: 0x05ea0120, event: 0x05ec0122
SCARD: SCardGetStatusChange(context: 0x0103b068, timeout: 0x00000000, count: 1)
SCARD:    "Gemplus GemPC Twin 00 00"
SCARD:        user: 0x00000000, state: 0x00000120, event: 0x00000122
SCARD:            current state: 0x05ec0120
SCARD: -> Success
SCARD:    "Gemplus GemPC Twin 00 00"
SCARD:        user: 0x00000000, state: 0x05ec0120, event: 0x05ee0122
SCARD: SCardGetStatusChange(context: 0x0103b068, timeout: 0x00000000, count: 1)
(...)


So I empirically tried to break this loop with this patch:

diff -aur rdesktop-1.6.0.orig/scard.c rdesktop-1.6.0/scard.c
--- rdesktop-1.6.0.orig/scard.c    2008-02-14 06:37:18.000000000 -0500
+++ rdesktop-1.6.0/scard.c    2009-01-13 11:31:23.000000000 -0500
@@ -2555,6 +2555,21 @@
                     SC_deviceControl(cur_data);
                     break;
                 }
+
+            case SC_GET_STATUS_CHANGE:
+                {
+                    /* Windows XP Pro sends indefinitely
+                     * this kind of request. If we ignore
+                     * the first one the process is stopped
+                     * and it is then possible to lock and
+                     * unlock the session with the
+                     * smartcard.
+                     *
+                     * FIXME: find out what would be the
+                     * good answer to the initial request.*/
+                    DEBUG_SCARD(("SCARD: ignored the SC_GET_STATUS_CHANGE request !\n"));
+                                    break;
+                }
             default:
                 {
                     SC_handleRequest(cur_data);


This works with my current hardware and on Debian/Lenny (pcsc-lite 1.4.102-1) but like I do not understand what really happens, I hope someone has a better solution.

Thanks