From 62ea190c0c5a99d2f06b02f4d45ad9d63906d897 Mon Sep 17 00:00:00 2001 From: Cendio Date: Thu, 1 Mar 2018 13:52:54 +0100 Subject: [PATCH] Exit rdesktop if error info is set This fixes a problem where a connect loop is triggered when a user is closing the session and there is a pending resize triggered. When server sends error info PDU, this means that the client should close and not enter a reconnect due to pending resize or other reason such as network error or redirect... Co-authored-by: Henrik Andersson Co-authored-by: Karl Mikaelsson Co-authored-by: Thomas Nilefalk --- rdesktop.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/rdesktop.c b/rdesktop.c index e633c21..522eaff 100644 --- a/rdesktop.c +++ b/rdesktop.c @@ -1395,6 +1395,7 @@ main(int argc, char *argv[]) deactivated = False; g_reconnect_loop = False; + ext_disc_reason = 0; rdp_main_loop(&deactivated, &ext_disc_reason); tcp_run_ui(False); @@ -1402,6 +1403,16 @@ main(int argc, char *argv[]) logger(Core, Verbose, "Disconnecting..."); rdp_disconnect(); + /* If error info is set we do want to exit rdesktop + connect loop. We do this by clearing flags that + triggers a reconnect that could be set elsewere */ + if (ext_disc_reason != 0) + { + g_redirect = False; + g_network_error = False; + g_pending_resize = False; + } + if (g_redirect) continue; @@ -1428,6 +1439,8 @@ main(int argc, char *argv[]) g_reconnect_loop = True; continue; } + + /* exit main reconnect loop */ break; }