necouchman commented on a change in pull request #228:
URL: https://github.com/apache/guacamole-server/pull/228#discussion_r418587708



##########
File path: src/protocols/rdp/rdp.c
##########
@@ -223,10 +223,53 @@ static BOOL rdp_freerdp_authenticate(freerdp* instance, 
char** username,
 
     rdpContext* context = instance->context;
     guac_client* client = ((rdp_freerdp_context*) context)->client;
-
-    /* Warn if connection is likely to fail due to lack of credentials */
-    guac_client_log(client, GUAC_LOG_INFO,
-            "Authentication requested but username or password not given");
+    guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
+    guac_rdp_settings* settings = rdp_client->settings;
+    char* params[4] = {};
+    int i = 0;
+    
+    if (settings->username == NULL || strcmp(settings->username, "") == 0) {
+        params[i] = "username";
+        rdp_client->rdp_credential_flags |= GUAC_RDP_CRED_FLAG_USERNAME;
+        i++;
+    }
+    
+    if (settings->password == NULL || strcmp(settings->password, "") == 0) {
+        params[i] = "password";
+        rdp_client->rdp_credential_flags |= GUAC_RDP_CRED_FLAG_PASSWORD;
+        i++;
+    }
+    
+    if (settings->domain == NULL || strcmp(settings->domain, "") == 0) {
+        params[i] = "domain";
+        rdp_client->rdp_credential_flags |= GUAC_RDP_CRED_FLAG_DOMAIN;
+        i++;
+    }
+    
+    /* NULL-terminate the array. */
+    params[i] = NULL;
+    
+    if (i > 0) {

Review comment:
       Maybe so, but I don't think we necessarily need anything on the 
server-side of this, I think it can all be accomplished on the guacamole-client 
side (I think).  My original code had it looking up the protocol for the 
connection and pulling down the form manually, but I opted for this route based 
on some of the changes Mike had made for the hidden menu and making changes 
on-the-fly.  I'm sure there's a way to do this elegantly :-).




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to