diff options
author | Rostislav Kondratenko <r.kondratenko@wwpass.com> | 2018-04-03 20:51:34 +0300 |
---|---|---|
committer | Alexander Zakharov <uglym8@gmail.com> | 2018-04-27 13:46:45 +0300 |
commit | 2abd25ae2a5eb1a1c1bdf86529d8bae102017289 (patch) | |
tree | 54db221b5cd10a8b0d5021dd65d3986697dafe18 | |
parent | 567b1f74326c8ccacbeedc39f4833f543ace23c7 (diff) | |
download | rdesktop-2abd25ae2a5eb1a1c1bdf86529d8bae102017289.zip |
Fix scard logon
-rw-r--r-- | proto.h | 1 | ||||
-rw-r--r-- | rdpdr.c | 24 | ||||
-rw-r--r-- | scard.c | 23 |
3 files changed, 48 insertions, 0 deletions
@@ -360,6 +360,7 @@ void scard_unlock(int lock); int scard_enum_devices(uint32 * id, char *optarg); void scardSetInfo(uint32 epoch, uint32 device, uint32 id, uint32 bytes_out); void scard_reset_state(); +void scard_release_all_contexts(void); /* *INDENT-OFF* */ #ifdef __cplusplus @@ -879,6 +879,30 @@ rdpdr_process(STREAM s) g_client_id = 0x815ed39d; /* IP address (use 127.0.0.1) 0x815ed39d */ g_epoch++; +#if WITH_SCARD + /* + * We need to release all SCARD contexts to end all + * current transactions and pending calls + */ + scard_release_all_contexts(); + + /* + * According to [MS-RDPEFS] 3.2.5.1.2: + * + * If this packet appears after a sequence of other packets, + * it is a signal that the server has reconnected to a new session + * and the whole sequence has been reset. The client MUST treat + * this packet as the beginning of a new sequence. + * The client MUST also cancel all outstanding requests and release + * previous references to all devices. + * + * If any problem arises in the future, please, pay attention to the + * "If this packet appears after a sequence of other packets" part + * + */ + +#endif + rdpdr_send_client_announce_reply(); rdpdr_send_client_name_request(); break; @@ -4,6 +4,7 @@ Copyright (C) Alexi Volkov <alexi@myrealbox.com> 2006 Copyright 2010-2013 Pierre Ossman <ossman@cendio.se> for Cendio AB Copyright 2011-2017 Henrik Andersson <hean01@cendio.se> for Cendio AB + Copyright 2015 Rostislav Kondratenko <r.kondratenk@wwpass.com> Copyright 2017 Karl Mikaelsson <derfian@cendio.se> for Cendio AB Copyright 2018 Alexander Zakharov <uglym8@gmail.com> @@ -2752,3 +2753,25 @@ scard_reset_state() queueFirst = queueLast = NULL; } + +void scard_release_all_contexts(void) +{ + _scard_handle_list_t *item, *next; + + item = g_scard_handle_list; + + while (item) + { + /* Cancelling ScardGetStatusChange calls */ + SCardCancel(item->handle); + /* releasing context to end all transactions on it */ + SCardReleaseContext(item->handle); + + next = item->next; + xfree(item); + item = next; + } + + g_scard_handle_list = NULL; +} + |