From bb9ba34f1dc2b329abf8d6da5bd1d573db9c42fb Mon Sep 17 00:00:00 2001 From: David FORT Date: Fri, 13 Feb 2015 18:25:50 +0100 Subject: [PATCH] Fix disconnection when negociation has failed This patch fixes a bug with mstsc connecting to a RDP security only FreeRDP server. It seems like the mstsc shipped with Windows Seven considers packets after the nego_failure packet as an error. So after trying to do TLS, depending on the timing, mstsc can print an error message instead of retrying to connect with RDP security. With this patch, we don't send the MCS disconnect message when the negociation has failed. --- libfreerdp/core/peer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libfreerdp/core/peer.c b/libfreerdp/core/peer.c index 5ba2630..b09caa1 100644 --- a/libfreerdp/core/peer.c +++ b/libfreerdp/core/peer.c @@ -567,6 +567,12 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra) static BOOL freerdp_peer_close(freerdp_peer* client) { + /** if negotiation has failed, we're not MCS connected. So don't + * send anything else, or some mstsc will consider that as an error + */ + if (client->context->rdp->nego->SelectedProtocol & PROTOCOL_FAILED_NEGO) + return TRUE; + /** * [MS-RDPBCGR] 1.3.1.4.2 User-Initiated Disconnection Sequence on Server * The server first sends the client a Deactivate All PDU followed by an -- 2.7.4