diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 5150a9a01..dc5e6a681 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -63,6 +63,7 @@ COMMAND_LINE_ARGUMENT_A args[] = { "gu", COMMAND_LINE_VALUE_REQUIRED, "[\\] or [@]", NULL, NULL, -1, NULL, "Gateway username" }, { "gp", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Gateway password" }, { "gd", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Gateway domain" }, + { "load-balance-info", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Load balance info" }, { "app", COMMAND_LINE_VALUE_REQUIRED, "|| or ", NULL, NULL, -1, NULL, "Remote application program" }, { "app-name", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Remote application name for user interface" }, { "app-icon", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Remote application icon for user interface" }, @@ -1214,6 +1215,11 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin settings->DisableWallpaper = TRUE; settings->DisableFullWindowDrag = TRUE; } + CommandLineSwitchCase(arg, "load-balance-info") + { + settings->LoadBalanceInfo = (BYTE*) _strdup(arg->Value); + settings->LoadBalanceInfoLength = strlen((char*) settings->LoadBalanceInfo); + } CommandLineSwitchCase(arg, "app-name") { settings->RemoteApplicationName = _strdup(arg->Value); diff --git a/client/common/file.c b/client/common/file.c index 755aa9391..a90a5fe81 100644 --- a/client/common/file.c +++ b/client/common/file.c @@ -517,6 +517,12 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* if (~((size_t) file->ShellWorkingDirectory)) settings->ShellWorkingDirectory = file->ShellWorkingDirectory; + if (~((size_t) file->LoadBalanceInfo)) + { + settings->LoadBalanceInfo = (BYTE*) _strdup(file->LoadBalanceInfo); + settings->LoadBalanceInfoLength = strlen((char*) settings->LoadBalanceInfo); + } + if (~file->ConnectionType) { freerdp_set_connection_type(settings, file->ConnectionType); diff --git a/libfreerdp/core/connection.c b/libfreerdp/core/connection.c index dabba597f..4b60d868b 100644 --- a/libfreerdp/core/connection.c +++ b/libfreerdp/core/connection.c @@ -135,6 +135,9 @@ BOOL rdp_client_connect(rdpRdp* rdp) nego_set_cookie_max_length(rdp->nego, settings->CookieMaxLength); + if (settings->LoadBalanceInfo) + nego_set_routing_token(rdp->nego, settings->LoadBalanceInfo, settings->LoadBalanceInfoLength); + if (!nego_connect(rdp->nego)) { fprintf(stderr, "Error: protocol security negotiation or connection failure\n"); diff --git a/libfreerdp/core/nego.c b/libfreerdp/core/nego.c index 6ee58d9b7..b15730228 100644 --- a/libfreerdp/core/nego.c +++ b/libfreerdp/core/nego.c @@ -648,12 +648,14 @@ BOOL nego_send_negotiation_request(rdpNego* nego) stream_get_mark(s, bm); stream_seek(s, length); - if (nego->RoutingToken != NULL) + if (nego->RoutingToken) { stream_write(s, nego->RoutingToken, nego->RoutingTokenLength); - length += nego->RoutingTokenLength; + stream_write_BYTE(s, 0x0D); /* CR */ + stream_write_BYTE(s, 0x0A); /* LF */ + length += nego->RoutingTokenLength + 2; } - else if (nego->cookie != NULL) + else if (nego->cookie) { cookie_length = strlen(nego->cookie);