From 7a6b8a04b9de0dbb017abca1ffc1f1422f255e76 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Fri, 13 Jul 2018 13:11:38 +0200 Subject: [PATCH] Fixed channel reconnect after redirect. --- libfreerdp/core/connection.c | 9 ++++++--- libfreerdp/core/freerdp.c | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libfreerdp/core/connection.c b/libfreerdp/core/connection.c index d13c0c8df..1aebc7604 100644 --- a/libfreerdp/core/connection.c +++ b/libfreerdp/core/connection.c @@ -353,7 +353,7 @@ BOOL rdp_client_disconnect_and_clear(rdpRdp* rdp) return TRUE; } -static BOOL rdp_client_reconnect_channels(rdpRdp* rdp) +static BOOL rdp_client_reconnect_channels(rdpRdp* rdp, BOOL redirect) { BOOL status; rdpContext* context; @@ -370,6 +370,9 @@ static BOOL rdp_client_reconnect_channels(rdpRdp* rdp) if (context->instance->ConnectionCallbackState == CLIENT_STATE_PRECONNECT_PASSED) { + if (redirect) + return TRUE; + if (!IFCALLRESULT(FALSE, context->instance->PostConnect, context->instance)) return FALSE; @@ -456,7 +459,7 @@ BOOL rdp_client_redirect(rdpRdp* rdp) status = rdp_client_connect(rdp); if (status) - status = rdp_client_reconnect_channels(rdp); + status = rdp_client_reconnect_channels(rdp, TRUE); return status; } @@ -479,7 +482,7 @@ BOOL rdp_client_reconnect(rdpRdp* rdp) status = rdp_client_connect(rdp); if (status) - status = rdp_client_reconnect_channels(rdp); + status = rdp_client_reconnect_channels(rdp, FALSE); return status; } diff --git a/libfreerdp/core/freerdp.c b/libfreerdp/core/freerdp.c index 41a47c897..231b8a1f3 100644 --- a/libfreerdp/core/freerdp.c +++ b/libfreerdp/core/freerdp.c @@ -218,6 +218,8 @@ BOOL freerdp_connect(freerdp* instance) { if (freerdp_get_last_error(instance->context) == FREERDP_ERROR_CONNECT_TRANSPORT_FAILED) status = freerdp_reconnect(instance); + else + goto freerdp_connect_finally; } if (!status || (status2 != CHANNEL_RC_OK)