From e4c7662148572b3af1a4b794fd56c6a6c09495ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Sat, 3 Sep 2011 17:02:26 -0400 Subject: [PATCH] libfreerdp-core: initial server redirection support --- libfreerdp-core/connection.c | 7 +++++++ libfreerdp-core/redirection.c | 7 ++++--- libfreerdp-core/transport.c | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libfreerdp-core/connection.c b/libfreerdp-core/connection.c index c22a97e7f..5d341b9da 100644 --- a/libfreerdp-core/connection.c +++ b/libfreerdp-core/connection.c @@ -116,6 +116,13 @@ boolean rdp_client_redirect(rdpRdp* rdp) rdp_client_disconnect(rdp); + mcs_free(rdp->mcs); + nego_free(rdp->nego); + transport_free(rdp->transport); + rdp->transport = transport_new(settings); + rdp->nego = nego_new(rdp->transport); + rdp->mcs = mcs_new(rdp->transport); + rdp->transport->layer = TRANSPORT_LAYER_TCP; settings->redirected_session_id = redirection->sessionID; diff --git a/libfreerdp-core/redirection.c b/libfreerdp-core/redirection.c index 91a1546f2..f301fec43 100644 --- a/libfreerdp-core/redirection.c +++ b/libfreerdp-core/redirection.c @@ -143,9 +143,10 @@ boolean rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s) stream_seek(s, 8); /* pad (8 bytes) */ - rdp_client_redirect(rdp); - - return True; + if (redirection->flags & LB_NOREDIRECT) + return True; + else + return rdp_client_redirect(rdp); } boolean rdp_recv_redirection_packet(rdpRdp* rdp, STREAM* s) diff --git a/libfreerdp-core/transport.c b/libfreerdp-core/transport.c index df007281b..790c0716a 100644 --- a/libfreerdp-core/transport.c +++ b/libfreerdp-core/transport.c @@ -289,6 +289,7 @@ int transport_check_fds(rdpTransport* transport) wait_obj_clear(transport->recv_event); status = transport_read_nonblocking(transport); + if (status < 0) return status;