From: Armin Novak Date: Mon, 19 Feb 2018 09:00:54 +0000 (+0100) Subject: Fixed .rdp and .msrcIncident checks. X-Git-Tag: 2.0.0-rc2~39^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=68641f109b5c256932f1a4e94491f3cb158a9371;p=platform%2Fupstream%2Ffreerdp.git Fixed .rdp and .msrcIncident checks. The command line detection fails, if only one of the aforementioned files is used as an argument. Detect those first and ignore command line detection if found. --- diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 40b0489..3ab1aba 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -1294,12 +1294,25 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, char* str; size_t length; int status; - DWORD flags; + BOOL ext = FALSE; + BOOL assist = FALSE; + DWORD flags = 0; BOOL promptForPassword = FALSE; - BOOL compatibility; + BOOL compatibility = FALSE; COMMAND_LINE_ARGUMENT_A* arg; - compatibility = freerdp_client_detect_command_line(argc, argv, &flags, - allowUnknown); + + /* Command line detection fails if only a .rdp or .msrcIncident file + * is supplied. Check this case first, only then try to detect + * legacy command line syntax. */ + if (argc > 1) + { + ext = ends_with(argv[1], ".rdp"); + assist = ends_with(argv[1], ".msrcIncident"); + } + + if (!ext && !assist) + compatibility = freerdp_client_detect_command_line(argc, argv, &flags, + allowUnknown); if (compatibility) { @@ -1309,27 +1322,19 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, else { if (allowUnknown) - { flags |= COMMAND_LINE_IGN_UNKNOWN_KEYWORD; - } - if (argc > 1) + if (ext) { - const BOOL ext = ends_with(argv[1], ".rdp"); - const BOOL assist = ends_with(argv[1], ".msrcIncident"); - - if (ext) - { - if (freerdp_client_settings_parse_connection_file(settings, argv[1])) - return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - } + if (freerdp_client_settings_parse_connection_file(settings, argv[1])) + return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; + } - if (assist) - { - if (freerdp_client_settings_parse_assistance_file(settings, - settings->AssistanceFile) < 0) - return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - } + if (assist) + { + if (freerdp_client_settings_parse_assistance_file(settings, + argv[1]) < 0) + return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; } CommandLineClearArgumentsA(args);