From 735c5778dbb62cd121fbab1f1a945b983e81afe2 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 1 Jan 2014 20:18:43 -0800 Subject: [PATCH] Ensure read errors result in the client closing. --- src/protocols/ssh/ssh_client.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/protocols/ssh/ssh_client.c b/src/protocols/ssh/ssh_client.c index e7efa41a..fe7453cb 100644 --- a/src/protocols/ssh/ssh_client.c +++ b/src/protocols/ssh/ssh_client.c @@ -457,6 +457,9 @@ void* ssh_client_thread(void* data) { total_read += bytes_read; } + else if (bytes_read < 0 && bytes_read != LIBSSH2_ERROR_EAGAIN) + break; + #ifdef ENABLE_SSH_AGENT /* If agent open, handle any agent packets */ if (client_data->auth_agent != NULL) { @@ -486,7 +489,8 @@ void* ssh_client_thread(void* data) { } - /* Wait for input thread to die */ + /* Kill client and Wait for input thread to die */ + guac_client_stop(client); pthread_join(input_thread, NULL); guac_client_log_info(client, "SSH connection ended.");