From f8430e246cab1cc2d180e29a8e995ebc60ca7860 Mon Sep 17 00:00:00 2001 From: lysannkessler Date: Wed, 25 Jul 2012 18:50:19 +0200 Subject: [PATCH] moved final security connection step into nego_connect for consistency --- libfreerdp-core/connection.c | 5 +---- libfreerdp-core/nego.c | 9 +++++++++ libfreerdp-core/nego.h | 1 - 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libfreerdp-core/connection.c b/libfreerdp-core/connection.c index 57e687752..b408992a0 100644 --- a/libfreerdp-core/connection.c +++ b/libfreerdp-core/connection.c @@ -84,13 +84,10 @@ boolean rdp_client_connect(rdpRdp* rdp) if (!nego_connect(rdp->nego)) { - printf("Error: protocol security negotiation failure\n"); + printf("Error: protocol security negotiation or connection failure\n"); return false; } - if (!nego_security_connect(rdp->nego)) - return false; - if ((rdp->nego->selected_protocol & PROTOCOL_TLS) || (rdp->nego->selected_protocol == PROTOCOL_RDP)) { if ((settings->username != NULL) && ((settings->password != NULL) || (settings->password_cookie != NULL && settings->password_cookie->length > 0))) diff --git a/libfreerdp-core/nego.c b/libfreerdp-core/nego.c index 388b257fc..0558fca6a 100644 --- a/libfreerdp-core/nego.c +++ b/libfreerdp-core/nego.c @@ -46,6 +46,8 @@ static const char PROTOCOL_SECURITY_STRINGS[3][4] = "NLA" }; +boolean nego_security_connect(rdpNego* nego); + /** * Negotiate protocol security and connect. * @param nego @@ -119,6 +121,13 @@ boolean nego_connect(rdpNego* nego) nego->transport->settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE; } + /* finally connect security layer (if not already done) */ + if(!nego_security_connect(nego)) + { + DEBUG_NEGO("Failed to connect with %s security", PROTOCOL_SECURITY_STRINGS[nego->selected_protocol]); + return false; + } + return true; } diff --git a/libfreerdp-core/nego.h b/libfreerdp-core/nego.h index 68a8d6504..cf30c94e9 100644 --- a/libfreerdp-core/nego.h +++ b/libfreerdp-core/nego.h @@ -99,7 +99,6 @@ struct rdp_nego typedef struct rdp_nego rdpNego; boolean nego_connect(rdpNego* nego); -boolean nego_security_connect(rdpNego* nego); boolean nego_send_preconnection_pdu(rdpNego* nego);