diff --git a/client/common/client.c b/client/common/client.c index 532d0ddb3..94d5d2ab7 100644 --- a/client/common/client.c +++ b/client/common/client.c @@ -102,6 +102,38 @@ HANDLE freerdp_client_get_thread(rdpContext* context) return ((rdpClientContext*) context)->thread; } +static BOOL freerdp_client_settings_post_process(rdpSettings* settings) +{ + /* Moved GatewayUseSameCredentials logic outside of cmdline.c, so + * that the rdp file also triggers this functionality */ + if (settings->GatewayEnabled) + { + if (settings->GatewayUseSameCredentials) + { + if (settings->Username) + { + settings->GatewayUsername = _strdup(settings->Username); + if (!settings->GatewayUsername) + return FALSE; + } + if (settings->Domain) + { + settings->GatewayDomain = _strdup(settings->Domain); + if (!settings->GatewayDomain) + return FALSE; + } + if (settings->Password) + { + settings->GatewayPassword = _strdup(settings->Password); + if (!settings->GatewayPassword) + return FALSE; + } + } + } + return TRUE; +} + + int freerdp_client_settings_parse_command_line(rdpSettings* settings, int argc, char** argv) { int status; @@ -124,35 +156,18 @@ int freerdp_client_settings_parse_command_line(rdpSettings* settings, int argc, status = freerdp_client_settings_parse_assistance_file(settings, settings->AssistanceFile); } + /* Only call post processing if no status/error was returned*/ + if (status < 0) + return status; + /* This function will call logic that is applicable to the settings * from command line parsing AND the rdp file parsing */ - status = freerdp_client_combined_logic(settings); + if(!freerdp_client_settings_post_process(settings)) + return -1; return status; } -int freerdp_client_combined_logic(rdpSettings* settings) -{ - /* Moved GatewayUseSameCredentials logic outside of cmdline.c, so - * that the rdp file also triggers this functionality */ - if (settings->GatewayEnabled) - { - if (settings->GatewayUseSameCredentials) - { - if (settings->Username) - settings->GatewayUsername = _strdup(settings->Username); - - if (settings->Domain) - settings->GatewayDomain = _strdup(settings->Domain); - - if (settings->Password) - settings->GatewayPassword = _strdup(settings->Password); - } - } - - return 0; -} - int freerdp_client_settings_parse_connection_file(rdpSettings* settings, const char* filename) { rdpFile* file;