channels/smartcard: cleanup of sanitization

This commit is contained in:
Marc-André Moreau 2014-04-12 15:09:23 -04:00
parent 7ff1c984c2
commit 5920dbc074
2 changed files with 12 additions and 4 deletions

View File

@ -491,7 +491,7 @@ UINT32 smartcard_ConnectA(SMARTCARD_DEVICE* smartcard, IRP* irp)
if ((call.Common.dwPreferredProtocols == SCARD_PROTOCOL_UNDEFINED) &&
(call.Common.dwShareMode != SCARD_SHARE_DIRECT))
{
call.Common.dwPreferredProtocols = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1;
call.Common.dwPreferredProtocols = SCARD_PROTOCOL_Tx;
}
status = ret.ReturnCode = SCardConnectA(hContext, (char*) call.szReader, call.Common.dwShareMode,
@ -538,7 +538,7 @@ UINT32 smartcard_ConnectW(SMARTCARD_DEVICE* smartcard, IRP* irp)
if ((call.Common.dwPreferredProtocols == SCARD_PROTOCOL_UNDEFINED) &&
(call.Common.dwShareMode != SCARD_SHARE_DIRECT))
{
call.Common.dwPreferredProtocols = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1;
call.Common.dwPreferredProtocols = SCARD_PROTOCOL_Tx;
}
status = ret.ReturnCode = SCardConnectW(hContext, (WCHAR*) call.szReader, call.Common.dwShareMode,

View File

@ -1135,6 +1135,11 @@ UINT32 smartcard_unpack_get_status_change_a_call(SMARTCARD_DEVICE* smartcard, wS
if (strcmp((char*) readerState->szReader, SMARTCARD_PNP_NOTIFICATION_A) == 0)
{
readerState->pvUserData = NULL;
readerState->dwCurrentState = 0;
readerState->dwEventState = 0;
readerState->cbAtr = 0;
ZeroMemory(&(readerState->rgbAtr), 36);
readerState->dwCurrentState |= SCARD_STATE_IGNORE;
}
}
@ -1299,6 +1304,11 @@ UINT32 smartcard_unpack_get_status_change_w_call(SMARTCARD_DEVICE* smartcard, wS
if (_wcscmp((WCHAR*) readerState->szReader, SMARTCARD_PNP_NOTIFICATION_W) == 0)
{
readerState->pvUserData = NULL;
readerState->dwCurrentState = 0;
readerState->dwEventState = 0;
readerState->cbAtr = 0;
ZeroMemory(&(readerState->rgbAtr), 36);
readerState->dwCurrentState |= SCARD_STATE_IGNORE;
}
}
@ -2011,8 +2021,6 @@ UINT32 smartcard_unpack_transmit_call(SMARTCARD_DEVICE* smartcard, wStream* s, T
return STATUS_BUFFER_TOO_SMALL;
}
winpr_HexDump(Stream_Pointer(s), Stream_GetRemainingLength(s));
Stream_Read_UINT32(s, length); /* Length (4 bytes) */
Stream_Read_UINT16(s, ioRecvPci.dwProtocol); /* dwProtocol (2 bytes) */