From 91af7ba5fcd47b7b6da54d3b7ff62f539a26d84b Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 22 Jun 2010 13:05:26 +0000 Subject: [PATCH] Let bogus control codes through with a warning, in case it might work anyway. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1597 423420c4-83ab-492f-b58f-81f9feb106b5 --- scard.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/scard.c b/scard.c index e910e83..4951b14 100644 --- a/scard.c +++ b/scard.c @@ -2038,13 +2038,19 @@ TS_SCardControl(STREAM in, STREAM out) in_uint8a(in, pInBuffer, nInBufferSize); } - /* Is this a proper Windows smart card ioctl? */ - if ((dwControlCode & 0xffff0000) != (49 << 16)) - return SCARD_E_INVALID_PARAMETER; + DEBUG_SCARD(("SCARD: SCardControl(context: 0x%08x, hcard: 0x%08x, code: 0x%08x, in: %d bytes, out: %d bytes)\n", (unsigned) hContext, (unsigned) hCard, (unsigned) dwControlCode, (int) nInBufferSize, (int) nOutBufferSize)); - /* Translate to local encoding */ - dwControlCode = (dwControlCode & 0x3ffc) >> 2; - dwControlCode = SCARD_CTL_CODE(dwControlCode); + /* Is this a proper Windows smart card ioctl? */ + if ((dwControlCode & 0xffff0000) == (49 << 16)) + { + /* Translate to local encoding */ + dwControlCode = (dwControlCode & 0x3ffc) >> 2; + dwControlCode = SCARD_CTL_CODE(dwControlCode); + } + else + { + warning("Bogus smart card control code 0x%08x\n", dwControlCode); + } #if 0 if (nOutBufferSize > 0) @@ -2062,8 +2068,6 @@ TS_SCardControl(STREAM in, STREAM out) if (!pOutBuffer) return SC_returnNoMemoryError(&lcHandle, in, out); - DEBUG_SCARD(("SCARD: SCardControl(context: 0x%08x, hcard: 0x%08x, code: 0x%08x, in: %d bytes, out: %d bytes)\n", (unsigned) hContext, (unsigned) hCard, (unsigned) dwControlCode, (int) nInBufferSize, (int) nOutBufferSize)); - sc_nBytesReturned = nBytesReturned; myHCard = scHandleToMyPCSC(hCard); #ifdef WITH_PCSC120