diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 93b86e697..6da7ea2ac 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -1898,6 +1898,13 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, settings->GatewayHttpTransport = TRUE; } } + CommandLineSwitchCase(arg, "gat") + { + free(settings->GatewayAccessToken); + + if (!(settings->GatewayAccessToken = _strdup(arg->Value))) + return COMMAND_LINE_ERROR_MEMORY; + } CommandLineSwitchCase(arg, "gateway-usage-method") { long type; diff --git a/client/common/cmdline.h b/client/common/cmdline.h index ed9d067e7..8b8008f63 100644 --- a/client/common/cmdline.h +++ b/client/common/cmdline.h @@ -92,6 +92,7 @@ static COMMAND_LINE_ARGUMENT_A args[] = { "grab-keyboard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Grab keyboard" }, { "gt", COMMAND_LINE_VALUE_REQUIRED, "rpc|http|auto", NULL, NULL, -1, NULL, "Gateway transport type" }, { "gu", COMMAND_LINE_VALUE_REQUIRED, "[\\] or [@]", NULL, NULL, -1, NULL, "Gateway username" }, + { "gat", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Gateway Access Token" }, { "h", COMMAND_LINE_VALUE_REQUIRED, "", "768", NULL, -1, NULL, "Height" }, { "heartbeat", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Support heartbeat PDUs" }, { "help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, NULL, NULL, NULL, -1, "?", "Print help" }, @@ -171,7 +172,7 @@ static COMMAND_LINE_ARGUMENT_A args[] = { "v", COMMAND_LINE_VALUE_REQUIRED, "[:port]", NULL, NULL, -1, NULL, "Server hostname" }, { "vc", COMMAND_LINE_VALUE_REQUIRED, "[,]", NULL, NULL, -1, NULL, "Static virtual channel" }, { "version", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_VERSION, NULL, NULL, NULL, -1, NULL, "Print version" }, - { "video", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Video optimized remoting channel" }, + { "video", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Video optimized remoting channel" }, { "vmconnect", COMMAND_LINE_VALUE_OPTIONAL, "", NULL, NULL, -1, NULL, "Hyper-V console (use port 2179, disable negotiation)" }, { "w", COMMAND_LINE_VALUE_REQUIRED, "", "1024", NULL, -1, NULL, "Width" }, { "wallpaper", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Enable wallpaper" }, diff --git a/client/common/file.c b/client/common/file.c index 8560df292..86df336e9 100644 --- a/client/common/file.c +++ b/client/common/file.c @@ -288,6 +288,8 @@ static int freerdp_client_rdp_file_set_string(rdpFile* file, const char* name, c tmp = &file->ShellWorkingDirectory; else if (_stricmp(name, "gatewayhostname") == 0) tmp = &file->GatewayHostname; + else if (_stricmp(name, "gatewayaccesstoken") == 0) + tmp = &file->GatewayAccessToken; else if (_stricmp(name, "kdcproxyname") == 0) tmp = &file->KdcProxyName; else if (_stricmp(name, "drivestoredirect") == 0) @@ -598,6 +600,7 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSett } SETTING_MODIFIED_SET_STRING(file->GatewayHostname, settings, GatewayHostname); + SETTING_MODIFIED_SET_STRING(file->GatewayAccessToken, settings, GatewayAccessToken); SETTING_MODIFIED_SET(file->GatewayUsageMethod, settings, GatewayUsageMethod); SETTING_MODIFIED_SET(file->PromptCredentialOnce, settings, GatewayUseSameCredentials); SETTING_MODIFIED_SET(file->RemoteApplicationMode, settings, RemoteApplicationMode); @@ -893,6 +896,12 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* free(host); } + if (~((size_t) file->GatewayAccessToken)) + { + if (freerdp_set_param_string(settings, FreeRDP_GatewayAccessToken, file->GatewayAccessToken) != 0) + return FALSE; + } + if (~file->GatewayUsageMethod) freerdp_set_gateway_usage_method(settings, file->GatewayUsageMethod); @@ -1314,6 +1323,7 @@ void freerdp_client_rdp_file_free(rdpFile* file) freerdp_client_file_string_check_free(file->AlternateShell); freerdp_client_file_string_check_free(file->ShellWorkingDirectory); freerdp_client_file_string_check_free(file->GatewayHostname); + freerdp_client_file_string_check_free(file->GatewayAccessToken); freerdp_client_file_string_check_free(file->KdcProxyName); freerdp_client_file_string_check_free(file->DrivesToRedirect); freerdp_client_file_string_check_free(file->DevicesToRedirect); diff --git a/include/freerdp/client/file.h b/include/freerdp/client/file.h index 307eba5f9..5765100f5 100644 --- a/include/freerdp/client/file.h +++ b/include/freerdp/client/file.h @@ -140,6 +140,7 @@ struct rdp_file DWORD GatewayUsageMethod; /* gatewayusagemethod */ DWORD GatewayProfileUsageMethod; /* gatewayprofileusagemethod */ DWORD GatewayCredentialsSource; /* gatewaycredentialssource */ + LPSTR GatewayAccessToken; /* gatewayaccesstoken */ DWORD UseRedirectionServerName; /* use redirection server name */ diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index a5dcad846..e35364b87 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -691,6 +691,7 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL; #define FreeRDP_GatewayRpcTransport 1994 #define FreeRDP_GatewayHttpTransport 1995 #define FreeRDP_GatewayUdpTransport 1996 +#define FreeRDP_GatewayAccessToken 1997 #define FreeRDP_ProxyType 2015 #define FreeRDP_ProxyHostname 2016 #define FreeRDP_ProxyPort 2017 @@ -1156,7 +1157,8 @@ struct rdp_settings ALIGN64 BOOL GatewayRpcTransport; /* 1994 */ ALIGN64 BOOL GatewayHttpTransport; /* 1995 */ ALIGN64 BOOL GatewayUdpTransport; /* 1996 */ - UINT64 padding2048[2015 - 1997]; /* 1997 */ + ALIGN64 char* GatewayAccessToken; /* 1997 */ + UINT64 padding2015[2015 - 1998]; /* 1998 */ /* Proxy */ ALIGN64 UINT32 ProxyType; /* 2015 */ @@ -1449,6 +1451,7 @@ struct rdp_settings ALIGN64 BYTE* SettingsModified; /* byte array marking fields that have been modified from their default value */ ALIGN64 char* ActionScript; + }; typedef struct rdp_settings rdpSettings; diff --git a/libfreerdp/common/settings.c b/libfreerdp/common/settings.c index 9bf72a435..f79a2820b 100644 --- a/libfreerdp/common/settings.c +++ b/libfreerdp/common/settings.c @@ -2503,6 +2503,9 @@ char* freerdp_get_param_string(rdpSettings* settings, int id) case FreeRDP_GatewayDomain: return settings->GatewayDomain; + case FreeRDP_GatewayAccessToken: + return settings->GatewayAccessToken; + case FreeRDP_ProxyHostname: return settings->ProxyHostname; @@ -2713,6 +2716,10 @@ int freerdp_set_param_string(rdpSettings* settings, int id, const char* param) tmp = &settings->GatewayDomain; break; + case FreeRDP_GatewayAccessToken: + tmp = &settings->GatewayAccessToken; + break; + case FreeRDP_ProxyHostname: tmp = &settings->ProxyHostname; break; diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c index eaf507046..4d249eb45 100644 --- a/libfreerdp/core/settings.c +++ b/libfreerdp/core/settings.c @@ -692,6 +692,7 @@ rdpSettings* freerdp_settings_clone(rdpSettings* settings) CHECKED_STRDUP(GatewayUsername); /* 1987 */ CHECKED_STRDUP(GatewayPassword); /* 1988 */ CHECKED_STRDUP(GatewayDomain); /* 1989 */ + CHECKED_STRDUP(GatewayAccessToken); /* 1997 */ CHECKED_STRDUP(ProxyHostname); /* 2016 */ CHECKED_STRDUP(RemoteApplicationName); /* 2113 */ CHECKED_STRDUP(RemoteApplicationIcon); /* 2114 */ @@ -1085,6 +1086,7 @@ void freerdp_settings_free(rdpSettings* settings) free(settings->GatewayUsername); free(settings->GatewayPassword); free(settings->GatewayDomain); + free(settings->GatewayAccessToken); free(settings->CertificateName); free(settings->DynamicDSTTimeZoneKeyName); free(settings->PreconnectionBlob);