From 4aeb52aace874da09b77079a2451feef3f9f4c38 Mon Sep 17 00:00:00 2001 From: Adam Brand Date: Mon, 30 Jan 2012 17:54:46 -0800 Subject: [PATCH] First attempt at fixing the password issue; this segfaults unfortunately. --- include/freerdp/settings.h | 3 ++- libfreerdp-core/connection.c | 4 ++-- libfreerdp-core/info.c | 12 ++++++++++-- libfreerdp-core/redirection.c | 11 ++++++++--- libfreerdp-core/redirection.h | 2 +- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index 3556f38a9..9b01160a6 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -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 */ diff --git a/libfreerdp-core/connection.c b/libfreerdp-core/connection.c index 0f2c40b94..102bcbd45 100644 --- a/libfreerdp-core/connection.c +++ b/libfreerdp-core/connection.c @@ -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); diff --git a/libfreerdp-core/info.c b/libfreerdp-core/info.c index 1336d25b7..0ed0a9bf2 100644 --- a/libfreerdp-core/info.c +++ b/libfreerdp-core/info.c @@ -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 != NULL) + { + 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; diff --git a/libfreerdp-core/redirection.c b/libfreerdp-core/redirection.c index 7dfc276c3..ede25b117 100644 --- a/libfreerdp-core/redirection.c +++ b/libfreerdp-core/redirection.c @@ -104,8 +104,13 @@ 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); + freerdp_blob_alloc(redirection->password_cookie, 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 +200,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); diff --git a/libfreerdp-core/redirection.h b/libfreerdp-core/redirection.h index 144e1fc40..165a5ced7 100644 --- a/libfreerdp-core/redirection.h +++ b/libfreerdp-core/redirection.h @@ -50,7 +50,7 @@ struct rdp_redirection rdpString tsvUrl; rdpString username; rdpString domain; - rdpString password; + rdpBlob* password_cookie; rdpString targetFQDN; rdpBlob loadBalanceInfo; rdpString targetNetBiosName;