From feca6d9750be21d89f3b071a8eab25eaaae7f935 Mon Sep 17 00:00:00 2001 From: tditsch Date: Mon, 18 Sep 2017 17:29:16 +0200 Subject: [PATCH 1/2] Fixed endless loop when RDP Server sends SERVER_DENIED_CONNECTION --- libfreerdp/core/transport.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index cb97cf38b..bd8d8539a 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -1053,6 +1053,10 @@ int transport_check_fds(rdpTransport* transport) transport->haveMoreBytesToRead = TRUE; } + if (freerdp_shall_disconnect(transport->context->instance)) { + return -1; + } + return 0; } From a16d9a2adeb6c009c5c59c0046a6d0d301ef784f Mon Sep 17 00:00:00 2001 From: tditsch Date: Tue, 19 Sep 2017 10:18:41 +0200 Subject: [PATCH 2/2] refactored Bugfix --- libfreerdp/core/transport.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index bd8d8539a..0ab37dd1d 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -997,8 +997,13 @@ int transport_check_fds(rdpTransport* transport) ResetEvent(transport->rereadEvent); } - while (!freerdp_shall_disconnect(transport->context->instance) && (now < dueDate)) + while (now < dueDate) { + + if (freerdp_shall_disconnect(transport->context->instance)) { + return -1; + } + /** * Note: transport_read_pdu tries to read one PDU from * the transport layer. @@ -1053,10 +1058,6 @@ int transport_check_fds(rdpTransport* transport) transport->haveMoreBytesToRead = TRUE; } - if (freerdp_shall_disconnect(transport->context->instance)) { - return -1; - } - return 0; }