Merge pull request #378 from adambprotiviti/redir-pw-fix

Fixed RDS Farm Redirection
This commit is contained in:
Marc-André Moreau 2012-01-30 22:55:37 -08:00
commit 413fc774c5
6 changed files with 31 additions and 12 deletions

View File

@ -269,7 +269,8 @@ struct rdp_settings
boolean autologon; /* 58 */
boolean compression; /* 59 */
uint32 performance_flags; /* 60 */
uint32 paddingC[80 - 61]; /* 61 */
rdpBlob* password_cookie; /* 61 */
uint32 paddingC[80 - 62]; /* 62 */
/* User Interface Parameters */
boolean sw_gdi; /* 80 */

View File

@ -82,7 +82,7 @@ boolean rdp_client_connect(rdpRdp* rdp)
if ((selectedProtocol & PROTOCOL_TLS) || (selectedProtocol == PROTOCOL_RDP))
{
if ((settings->username != NULL) && (settings->password != NULL))
if ((settings->username != NULL) && ((settings->password != NULL) || (settings->password_cookie->length > 0)))
settings->autologon = true;
}
@ -177,8 +177,8 @@ boolean rdp_client_redirect(rdpRdp* rdp)
if (redirection->flags & LB_PASSWORD)
{
xfree(settings->password);
settings->password = redirection->password.ascii;
freerdp_blob_free(settings->password_cookie);
settings->password_cookie = redirection->password_cookie;
}
return rdp_client_connect(rdp);

View File

@ -505,8 +505,16 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings)
userName = (uint8*)freerdp_uniconv_out(settings->uniconv, settings->username, &length);
cbUserName = length;
password = (uint8*)freerdp_uniconv_out(settings->uniconv, settings->password, &length);
cbPassword = length;
if (settings->password_cookie->length > 0)
{
password = (uint8*)settings->password_cookie->data;
cbPassword = settings->password_cookie->length - 2;
}
else
{
password = (uint8*)freerdp_uniconv_out(settings->uniconv, settings->password, &length);
cbPassword = length;
}
alternateShell = (uint8*)freerdp_uniconv_out(settings->uniconv, settings->shell, &length);
cbAlternateShell = length;
@ -532,7 +540,7 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings)
stream_write_uint16(s, 0);
if (cbPassword > 0)
stream_write(s, password, cbPassword);
stream_write(s, password, cbPassword + 2);
stream_write_uint16(s, 0);
if (cbAlternateShell > 0)

View File

@ -104,8 +104,16 @@ boolean rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s)
if (redirection->flags & LB_PASSWORD)
{
freerdp_string_read_length32(s, &redirection->password, rdp->settings->uniconv);
DEBUG_REDIR("password: %s", redirection->password.ascii);
uint32 passwordLength;
stream_read_uint32(s, passwordLength);
redirection->password_cookie = xnew(rdpBlob);
freerdp_blob_alloc(redirection->password_cookie, passwordLength);
stream_read(s, redirection->password_cookie->data, passwordLength);
#ifdef WITH_DEBUG_REDIR
DEBUG_REDIR("password_cookie:");
freerdp_hexdump(redirection->password_cookie->data, redirection->password_cookie->length);
#endif
}
if (redirection->flags & LB_TARGET_FQDN)
@ -195,7 +203,7 @@ void redirection_free(rdpRedirection* redirection)
freerdp_string_free(&redirection->tsvUrl);
freerdp_string_free(&redirection->username);
freerdp_string_free(&redirection->domain);
freerdp_string_free(&redirection->password);
freerdp_blob_free(redirection->password_cookie);
freerdp_string_free(&redirection->targetFQDN);
freerdp_string_free(&redirection->targetNetBiosName);
freerdp_string_free(&redirection->targetNetAddress);

View File

@ -50,7 +50,7 @@ struct rdp_redirection
rdpString tsvUrl;
rdpString username;
rdpString domain;
rdpString password;
rdpBlob* password_cookie;
rdpString targetFQDN;
rdpBlob loadBalanceInfo;
rdpString targetNetBiosName;

View File

@ -172,7 +172,7 @@ rdpSettings* settings_new(void* instance)
settings->server_auto_reconnect_cookie = xnew(ARC_SC_PRIVATE_PACKET);
settings->client_time_zone = xnew(TIME_ZONE_INFO);
settings->password_cookie = xnew(rdpBlob);
settings->server_random = xnew(rdpBlob);
settings->server_certificate = xnew(rdpBlob);
@ -190,6 +190,8 @@ void settings_free(rdpSettings* settings)
xfree(settings->hostname);
xfree(settings->username);
xfree(settings->password);
freerdp_blob_free(settings->password_cookie);
xfree(settings->password_cookie);
xfree(settings->domain);
xfree(settings->shell);
xfree(settings->directory);