From bd40dd30b2da5b730e9e54deef478114ae7e7337 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 19 Mar 2014 22:16:35 -0700 Subject: [PATCH] GUAC-556: Send UPSTREAM_ERROR for unexpected disconnect and failure to connect in RDP. --- src/protocols/rdp/client.c | 2 +- src/protocols/rdp/guac_handlers.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/protocols/rdp/client.c b/src/protocols/rdp/client.c index 9cd936a9..c815af33 100644 --- a/src/protocols/rdp/client.c +++ b/src/protocols/rdp/client.c @@ -676,7 +676,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) { guac_protocol_send_error(client->socket, "Error connecting to RDP server", - GUAC_PROTOCOL_STATUS_SERVER_ERROR); + GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR); guac_socket_flush(client->socket); guac_error = GUAC_STATUS_BAD_STATE; diff --git a/src/protocols/rdp/guac_handlers.c b/src/protocols/rdp/guac_handlers.c index fcc25e2f..830ea36e 100644 --- a/src/protocols/rdp/guac_handlers.c +++ b/src/protocols/rdp/guac_handlers.c @@ -261,8 +261,12 @@ int rdp_guac_client_handle_messages(guac_client* client) { } /* If an error occurred, fail */ - if (wait_result < 0) + if (wait_result < 0) { + guac_protocol_send_error(client->socket, "Connection closed.", + GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR); + guac_socket_flush(client->socket); return 1; + } /* Success */ return 0;