Compare commits

...

1 Commits

Author SHA1 Message Date
Nick Couchman
ea62950dee GUACAMOLE-1167: Add server settings for RD gateway type. 2020-12-29 00:17:32 -05:00
2 changed files with 74 additions and 1 deletions

View File

@ -112,6 +112,7 @@ const char* GUAC_RDP_CLIENT_ARGS[] = {
"gateway-hostname", "gateway-hostname",
"gateway-port", "gateway-port",
"gateway-type",
"gateway-domain", "gateway-domain",
"gateway-username", "gateway-username",
"gateway-password", "gateway-password",
@ -549,6 +550,13 @@ enum RDP_ARGS_IDX {
*/ */
IDX_GATEWAY_PORT, IDX_GATEWAY_PORT,
/**
* Explicitly set the mode for the RDP gateway. This can either be set to
* auto, in which case the RDP client will attempt to auto-detect the mode,
* or can be forced to either HTTP or RPC.
*/
IDX_GATEWAY_TYPE,
/** /**
* The domain of the user authenticating with the remote desktop gateway, * The domain of the user authenticating with the remote desktop gateway,
* if a gateway is being used. This is not necessarily the same as the * if a gateway is being used. This is not necessarily the same as the
@ -1079,6 +1087,20 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
guac_user_parse_args_int(user, GUAC_RDP_CLIENT_ARGS, argv, guac_user_parse_args_int(user, GUAC_RDP_CLIENT_ARGS, argv,
IDX_GATEWAY_PORT, 443); IDX_GATEWAY_PORT, 443);
char* gateway_type = guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS,
argv, IDX_GATEWAY_TYPE, NULL);
if (strcmp(gateway_type, "auto") == 0)
settings->gateway_type = GUAC_RDP_GATEWAY_AUTO;
else if (strcmp(gateway_type, "http") == 0)
settings->gateway_type = GUAC_RDP_GATEWAY_HTTP;
else if (strcmp(gateway_type, "rpc") == 0)
settings->gateway_type = GUAC_RDP_GATEWAY_RPC;
free(gateway_type);
/* Set gateway domain */ /* Set gateway domain */
settings->gateway_domain = settings->gateway_domain =
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv, guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
@ -1195,6 +1217,7 @@ void guac_rdp_settings_free(guac_rdp_settings* settings) {
/* Free RD gateway information */ /* Free RD gateway information */
free(settings->gateway_hostname); free(settings->gateway_hostname);
free(settings->gateway_type);
free(settings->gateway_domain); free(settings->gateway_domain);
free(settings->gateway_username); free(settings->gateway_username);
free(settings->gateway_password); free(settings->gateway_password);
@ -1438,6 +1461,28 @@ void guac_rdp_push_settings(guac_client* client,
rdp_settings->GatewayUsername = guac_strdup(guac_settings->gateway_username); rdp_settings->GatewayUsername = guac_strdup(guac_settings->gateway_username);
rdp_settings->GatewayPassword = guac_strdup(guac_settings->gateway_password); rdp_settings->GatewayPassword = guac_strdup(guac_settings->gateway_password);
/* Check RD gateway type setting and set options appropriately. */
switch(guac_settings->gateway_type) {
/* Gateway is set to auto, so enable either transport. */
case GUAC_RDP_GATEWAY_AUTO:
rdp_settings->GatewayHttpTransport = TRUE;
rdp_settings->GatewayRpcTransport = TRUE;
break;
/* Gateway is forced to HTTP, so only enable HTTP transport. */
case GUAC_RDP_GATEWAY_HTTP:
rdp_settings->GatewayHttpTransport = TRUE;
rdp_settings->GatewayRpcTransport = FALSE;
break;
/* Gateway is forced to RPC, so only enable RPC transport. */
case GUAC_RDP_GATEWAY_RPC:
rdp_settings->GatewayHttpTransport = FALSE;
rdp_settings->GatewayRpcTransport = TRUE;
break;
}
} }
/* Store load balance info (and calculate length) if provided */ /* Store load balance info (and calculate length) if provided */

View File

@ -110,6 +110,28 @@ typedef enum guac_rdp_security {
} guac_rdp_security; } guac_rdp_security;
/**
* Supported modes of the RDP gateway.
*/
typedef enum guac_rdp_gateway_type {
/**
* Automatically detect the type of gateway in use.
*/
GUAC_RDP_GATEWAY_AUTO,
/**
* Set the mode of the RDP gateway to HTTP.
*/
GUAC_RDP_GATEWAY_HTTP,
/**
* Set the mode of the RDP gateway to RPC.
*/
GUAC_RDP_GATEWAY_RPC
} guac_rdp_gateway_type;
/** /**
* All supported combinations screen resize methods. * All supported combinations screen resize methods.
*/ */
@ -540,6 +562,12 @@ typedef struct guac_rdp_settings {
*/ */
int gateway_port; int gateway_port;
/**
* Set the mode of the RDP gateway. The gateway can either be auto-detected,
* or can be forced to HTTP or RPC mode.
*/
guac_rdp_gateway_type gateway_type;
/** /**
* The domain of the user authenticating with the remote desktop gateway, * The domain of the user authenticating with the remote desktop gateway,
* if a gateway is being used. This is not necessarily the same as the * if a gateway is being used. This is not necessarily the same as the