summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Zakharov <uglym8@gmail.com>2018-04-05 18:19:32 +0300
committerAlexander Zakharov <uglym8@gmail.com>2018-04-27 13:46:45 +0300
commitb77d00ceba32da5db3d6232ff16cf280c0ad337b (patch)
tree0282c1bf000205f74a6608aa34e67fb257c1883e
parent58f855a3a23ad8861ee8dbec943322049b9fd69b (diff)
downloadrdesktop-b77d00ceba32da5db3d6232ff16cf280c0ad337b.zip
Fix TS_SCardEstablishContext/TS_SCardIsValidContext
Current approach for TS_SCardEstablishContext() causes Windows not to detect scard reader insertion in a case when rdesktop was lauched without attached reader(s). Thanks to demansong@gmail.com for the help to pinpoint this issue.
-rw-r--r--scard.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/scard.c b/scard.c
index ad55096..65297c9 100644
--- a/scard.c
+++ b/scard.c
@@ -684,8 +684,6 @@ TS_SCardEstablishContext(STREAM in, STREAM out)
MYPCSC_DWORD rv;
MYPCSC_SCARDCONTEXT myHContext;
SERVER_SCARDCONTEXT hContext;
- char *readers = NULL;
- DWORD readerCount = 1024;
hContext = 0;
@@ -706,21 +704,6 @@ TS_SCardEstablishContext(STREAM in, STREAM out)
goto bail_out;
}
- /* This is a workaround where windows application generally
- behaves better with polling of smartcard subsystem
- availability than were there are no readers available. */
- rv = SCardListReaders(myHContext, NULL, readers, &readerCount);
- if (rv != SCARD_S_SUCCESS)
- {
- logger(SmartCard, Debug,
- "TS_SCardEstablishContext(), No readers connected, return no service to client.");
- rv = SCARD_E_NO_SERVICE;
- SCardReleaseContext(myHContext);
- goto bail_out;
- }
-
-
-
/* add context to list of handle and get server handle */
_scard_handle_list_add(myHContext);
hContext = _scard_handle_list_get_server_handle(myHContext);
@@ -780,9 +763,6 @@ TS_SCardIsValidContext(STREAM in, STREAM out)
MYPCSC_DWORD rv;
SERVER_SCARDCONTEXT hContext;
MYPCSC_SCARDCONTEXT myHContext;
- char *readers;
- DWORD readerCount = 1024;
- PMEM_HANDLE lcHandle = NULL;
in->p += 0x1C;
in_uint32_le(in, hContext);
@@ -792,13 +772,7 @@ TS_SCardIsValidContext(STREAM in, STREAM out)
logger(SmartCard, Debug, "TS_SCardIsValidContext(), context: 0x%08x [0x%lx]",
(unsigned) hContext, myHContext);
- /* There is no realization of SCardIsValidContext in PC/SC Lite so we call SCardListReaders */
-
- readers = SC_xmalloc(&lcHandle, 1024);
- if (!readers)
- return SC_returnNoMemoryError(&lcHandle, in, out);
-
- rv = SCardListReaders(myHContext, NULL, readers, &readerCount);
+ rv = SCardIsValidContext(myHContext);
if (rv)
{
@@ -814,7 +788,6 @@ TS_SCardIsValidContext(STREAM in, STREAM out)
}
outForceAlignment(out, 8);
- SC_xfreeallmemory(&lcHandle);
return rv;
}