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
This commit is contained in:
Pierre Ossman 2010-06-22 13:05:26 +00:00
parent 7e759ced83
commit 91af7ba5fc

14
scard.c
View File

@ -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));
/* 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