summaryrefslogtreecommitdiffstats
path: root/libfreerdp/emu/scard/smartcard_emulate.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:25:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:25:11 +0000
commit941f9937e0744d18de4cc0afa71e0caa925d82ac (patch)
tree67872b86dbf72d73e91188bf8de12594668fe4aa /libfreerdp/emu/scard/smartcard_emulate.c
parentAdding upstream version 3.3.0+dfsg1. (diff)
downloadfreerdp3-941f9937e0744d18de4cc0afa71e0caa925d82ac.tar.xz
freerdp3-941f9937e0744d18de4cc0afa71e0caa925d82ac.zip
Adding upstream version 3.5.0+dfsg1.upstream/3.5.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libfreerdp/emu/scard/smartcard_emulate.c')
-rw-r--r--libfreerdp/emu/scard/smartcard_emulate.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libfreerdp/emu/scard/smartcard_emulate.c b/libfreerdp/emu/scard/smartcard_emulate.c
index b2809c3..d517bd6 100644
--- a/libfreerdp/emu/scard/smartcard_emulate.c
+++ b/libfreerdp/emu/scard/smartcard_emulate.c
@@ -19,6 +19,7 @@
*/
#include <freerdp/config.h>
+#include <freerdp/freerdp.h>
#include <winpr/crt.h>
#include <winpr/wlog.h>
@@ -1362,6 +1363,10 @@ LONG WINAPI Emulate_SCardGetStatusChangeA(SmartcardEmulationContext* smartcard,
SCardContext* value = HashTable_GetItemValue(smartcard->contexts, (const void*)hContext);
WINPR_ASSERT(value); /* Must be valid after Emulate_SCardIsValidContext */
+ freerdp* inst =
+ freerdp_settings_get_pointer_writable(smartcard->settings, FreeRDP_instance);
+ WINPR_ASSERT(inst);
+
status = SCARD_E_TIMEOUT;
do
{
@@ -1410,6 +1415,11 @@ LONG WINAPI Emulate_SCardGetStatusChangeA(SmartcardEmulationContext* smartcard,
Sleep(diff);
if (dwTimeout != INFINITE)
dwTimeout -= MIN(dwTimeout, diff);
+ if (freerdp_shall_disconnect_context(inst->context))
+ {
+ status = SCARD_E_CANCELLED;
+ break;
+ }
} while (dwTimeout > 0);
}
@@ -1436,6 +1446,10 @@ LONG WINAPI Emulate_SCardGetStatusChangeW(SmartcardEmulationContext* smartcard,
SCardContext* value = HashTable_GetItemValue(smartcard->contexts, (const void*)hContext);
WINPR_ASSERT(value); /* Must be valid after Emulate_SCardIsValidContext */
+ freerdp* inst =
+ freerdp_settings_get_pointer_writable(smartcard->settings, FreeRDP_instance);
+ WINPR_ASSERT(inst);
+
status = SCARD_E_TIMEOUT;
do
{
@@ -1483,6 +1497,11 @@ LONG WINAPI Emulate_SCardGetStatusChangeW(SmartcardEmulationContext* smartcard,
Sleep(diff);
if (dwTimeout != INFINITE)
dwTimeout -= MIN(dwTimeout, diff);
+ if (freerdp_shall_disconnect_context(inst->context))
+ {
+ status = SCARD_E_CANCELLED;
+ break;
+ }
} while (dwTimeout > 0);
}