From 3b4007c9fa5ce11bdd974443b8bbd4fbd04117c7 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Fri, 18 Sep 2020 22:04:51 -0400 Subject: [PATCH] GUACAMOLE-221: Tweak logic for when RDP domain is requested. --- src/protocols/rdp/rdp.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/protocols/rdp/rdp.c b/src/protocols/rdp/rdp.c index 6c80abcd..b31be494 100644 --- a/src/protocols/rdp/rdp.c +++ b/src/protocols/rdp/rdp.c @@ -256,6 +256,14 @@ static BOOL rdp_freerdp_authenticate(freerdp* instance, char** username, guac_argv_register(GUAC_RDP_ARGV_USERNAME, guac_rdp_argv_callback, NULL, 0); params[i] = GUAC_RDP_ARGV_USERNAME; i++; + + /* If username is undefined and domain is also undefined, request domain. */ + if (settings->domain == NULL) { + guac_argv_register(GUAC_RDP_ARGV_DOMAIN, guac_rdp_argv_callback, NULL, 0); + params[i] = GUAC_RDP_ARGV_DOMAIN; + i++; + } + } /* If the password is undefined, add it to the requested parameters. */ @@ -265,13 +273,6 @@ static BOOL rdp_freerdp_authenticate(freerdp* instance, char** username, i++; } - /* If the domain is undefined, add it to the requested parameters. */ - if (settings->domain == NULL) { - guac_argv_register(GUAC_RDP_ARGV_DOMAIN, guac_rdp_argv_callback, NULL, 0); - params[i] = GUAC_RDP_ARGV_DOMAIN; - i++; - } - /* NULL-terminate the array. */ params[i] = NULL;