From e447e57aa93b0cafd326807ea945f17bc35575ec Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Fri, 16 Dec 2016 12:56:17 +0100 Subject: [PATCH 1/2] New argument /auto-reconnect-max-retries: --- client/common/cmdline.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 59359c863..8505291b2 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -168,6 +168,7 @@ static COMMAND_LINE_ARGUMENT_A args[] = { "play-rfx", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Replay rfx pcap file" }, { "auth-only", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Authenticate only." }, { "auto-reconnect", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Automatic reconnection" }, + { "auto-reconnect-max-retries", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Automatic reconnection maximum retries" }, { "reconnect-cookie", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Pass base64 reconnect cookie to the connection" }, { "print-reconnect-cookie", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Print base64 reconnect cookie after connecting" }, { "heartbeat", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Support heartbeat PDUs" }, @@ -2309,6 +2310,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, CommandLineSwitchCase(arg, "max-loop-time") { settings->MaxTimeInCheckLoop = atoi(arg->Value); + if ((long) settings->MaxTimeInCheckLoop < 0) { WLog_ERR(TAG, "invalid max loop time: %s", arg->Value); @@ -2360,6 +2362,13 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, { settings->AutoReconnectionEnabled = arg->Value ? TRUE : FALSE; } + CommandLineSwitchCase(arg, "auto-reconnect-max-retries") + { + settings->AutoReconnectMaxRetries = atoi(arg->Value); + + if (settings->AutoReconnectMaxRetries <= 0) + return COMMAND_LINE_ERROR; + } CommandLineSwitchCase(arg, "reconnect-cookie") { BYTE* base64; @@ -2523,9 +2532,8 @@ static BOOL freerdp_client_load_static_channel_addin(rdpChannels* channels, { PVIRTUALCHANNELENTRY entry = NULL; PVIRTUALCHANNELENTRYEX entryEx = NULL; - entryEx = (PVIRTUALCHANNELENTRYEX) freerdp_load_channel_addin_entry(name, NULL, NULL, - FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX); + FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX); if (!entryEx) entry = freerdp_load_channel_addin_entry(name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC); From d7df692fe9ca5909b79df83f7867c06562967bb8 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 19 Dec 2016 09:17:08 +0100 Subject: [PATCH 2/2] Sanity check for auto reconnect retries. --- client/common/cmdline.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 8505291b2..07b3f3936 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -168,7 +168,7 @@ static COMMAND_LINE_ARGUMENT_A args[] = { "play-rfx", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Replay rfx pcap file" }, { "auth-only", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Authenticate only." }, { "auto-reconnect", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Automatic reconnection" }, - { "auto-reconnect-max-retries", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Automatic reconnection maximum retries" }, + { "auto-reconnect-max-retries", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Automatic reconnection maximum retries [1,1000]" }, { "reconnect-cookie", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Pass base64 reconnect cookie to the connection" }, { "print-reconnect-cookie", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Print base64 reconnect cookie after connecting" }, { "heartbeat", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Support heartbeat PDUs" }, @@ -2366,7 +2366,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, { settings->AutoReconnectMaxRetries = atoi(arg->Value); - if (settings->AutoReconnectMaxRetries <= 0) + if ((settings->AutoReconnectMaxRetries == 0) || + (settings->AutoReconnectMaxRetries > 1000)) return COMMAND_LINE_ERROR; } CommandLineSwitchCase(arg, "reconnect-cookie")