Added option to disable gateway websocket support

This commit is contained in:
Armin Novak 2021-03-05 12:59:33 +01:00 committed by akallabeth
parent 618227d751
commit 5fc2290c03
8 changed files with 40 additions and 12 deletions

View File

@ -2234,15 +2234,29 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
settings->GatewayRpcTransport = TRUE;
settings->GatewayHttpTransport = FALSE;
}
else if (_stricmp(arg->Value, "http") == 0)
else
{
settings->GatewayRpcTransport = FALSE;
settings->GatewayHttpTransport = TRUE;
}
else if (_stricmp(arg->Value, "auto") == 0)
{
settings->GatewayRpcTransport = TRUE;
settings->GatewayHttpTransport = TRUE;
char* c = strchr(arg->Value, ',');
if (c)
{
*c++ = '\0';
if (_stricmp(c, "no-websockets") != 0)
{
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
}
freerdp_settings_set_bool(settings, FreeRDP_GatewayHttpUseWebsockets, FALSE);
}
if (_stricmp(arg->Value, "http") == 0)
{
settings->GatewayRpcTransport = FALSE;
settings->GatewayHttpTransport = TRUE;
}
else if (_stricmp(arg->Value, "auto") == 0)
{
settings->GatewayRpcTransport = TRUE;
settings->GatewayHttpTransport = TRUE;
}
}
}
CommandLineSwitchCase(arg, "gat")

View File

@ -181,8 +181,8 @@ static const COMMAND_LINE_ARGUMENT_A args[] = {
{ "grab-keyboard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
"Grab keyboard" },
{ "grab-mouse", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Grab mouse" },
{ "gt", COMMAND_LINE_VALUE_REQUIRED, "[rpc|http|auto]", NULL, NULL, -1, NULL,
"Gateway transport type" },
{ "gt", COMMAND_LINE_VALUE_REQUIRED, "[rpc|http[,no-websockets]|auto[,no-websockets]]", NULL,
NULL, -1, NULL, "Gateway transport type" },
{ "gu", COMMAND_LINE_VALUE_REQUIRED, "[[<domain>\\]<user>|<user>[@<domain>]]", NULL, NULL, -1,
NULL, "Gateway username" },
{ "gat", COMMAND_LINE_VALUE_REQUIRED, "<access token>", NULL, NULL, -1, NULL,

View File

@ -752,6 +752,7 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL;
#define FreeRDP_GatewayAccessToken (1997)
#define FreeRDP_GatewayAcceptedCert (1998)
#define FreeRDP_GatewayAcceptedCertLength (1999)
#define FreeRDP_GatewayHttpUseWebsockets (2000)
#define FreeRDP_ProxyType (2015)
#define FreeRDP_ProxyHostname (2016)
#define FreeRDP_ProxyPort (2017)
@ -1258,7 +1259,8 @@ struct rdp_settings
ALIGN64 char* GatewayAccessToken; /* 1997 */
ALIGN64 char* GatewayAcceptedCert; /* 1998 */
ALIGN64 UINT32 GatewayAcceptedCertLength; /* 1999 */
UINT64 padding2015[2015 - 2000]; /* 2000 */
ALIGN64 BOOL GatewayHttpUseWebsockets; /* 2000 */
UINT64 padding2015[2015 - 2001]; /* 2001 */
/* Proxy */
ALIGN64 UINT32 ProxyType; /* 2015 */

View File

@ -194,6 +194,9 @@ BOOL freerdp_settings_get_bool(const rdpSettings* settings, size_t id)
case FreeRDP_GatewayHttpTransport:
return settings->GatewayHttpTransport;
case FreeRDP_GatewayHttpUseWebsockets:
return settings->GatewayHttpUseWebsockets;
case FreeRDP_GatewayRpcTransport:
return settings->GatewayRpcTransport;
@ -759,6 +762,10 @@ BOOL freerdp_settings_set_bool(rdpSettings* settings, size_t id, BOOL val)
settings->GatewayHttpTransport = val;
break;
case FreeRDP_GatewayHttpUseWebsockets:
settings->GatewayHttpUseWebsockets = val;
break;
case FreeRDP_GatewayRpcTransport:
settings->GatewayRpcTransport = val;
break;

View File

@ -74,6 +74,7 @@ static const struct settings_str_entry settings_map[] = {
{ FreeRDP_GatewayBypassLocal, 0, "FreeRDP_GatewayBypassLocal" },
{ FreeRDP_GatewayEnabled, 0, "FreeRDP_GatewayEnabled" },
{ FreeRDP_GatewayHttpTransport, 0, "FreeRDP_GatewayHttpTransport" },
{ FreeRDP_GatewayHttpUseWebsockets, 0, "FreeRDP_GatewayHttpUseWebsockets" },
{ FreeRDP_GatewayRpcTransport, 0, "FreeRDP_GatewayRpcTransport" },
{ FreeRDP_GatewayUdpTransport, 0, "FreeRDP_GatewayUdpTransport" },
{ FreeRDP_GatewayUseSameCredentials, 0, "FreeRDP_GatewayUseSameCredentials" },

View File

@ -2556,7 +2556,9 @@ rdpRdg* rdg_new(rdpContext* context)
!http_context_set_user_agent(rdg->http, "MS-RDGateway/1.0") ||
!http_context_set_host(rdg->http, rdg->settings->GatewayHostname) ||
!http_context_set_rdg_connection_id(rdg->http, bracedUuid) ||
!http_context_enable_websocket_upgrade(rdg->http, TRUE))
!http_context_enable_websocket_upgrade(
rdg->http,
freerdp_settings_get_bool(rdg->settings, FreeRDP_GatewayHttpUseWebsockets)))
{
goto rdg_alloc_error;
}

View File

@ -541,6 +541,7 @@ rdpSettings* freerdp_settings_new(DWORD flags)
!freerdp_settings_set_bool(settings, FreeRDP_GatewayRpcTransport, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_GatewayHttpTransport, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_GatewayUdpTransport, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_GatewayHttpUseWebsockets, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_FastPathInput, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_FastPathOutput, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_LongCredentialsSupported, TRUE) ||

View File

@ -63,6 +63,7 @@ static const size_t bool_list_indices[] = {
FreeRDP_GatewayBypassLocal,
FreeRDP_GatewayEnabled,
FreeRDP_GatewayHttpTransport,
FreeRDP_GatewayHttpUseWebsockets,
FreeRDP_GatewayRpcTransport,
FreeRDP_GatewayUdpTransport,
FreeRDP_GatewayUseSameCredentials,