From 8838199f5c00e7bc855a90e7a3b86efdc1ed2c53 Mon Sep 17 00:00:00 2001 From: Tomer Gabel Date: Thu, 23 Apr 2020 16:53:17 +0300 Subject: [PATCH 1/3] GUACAMOLE-1047: Notify connecting client on unrecognized connection ID --- src/guacd/connection.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/guacd/connection.c b/src/guacd/connection.c index ef767acb..2cf3d291 100644 --- a/src/guacd/connection.c +++ b/src/guacd/connection.c @@ -278,10 +278,18 @@ static int guacd_route_connection(guacd_proc_map* map, guac_socket* socket) { proc = guacd_proc_map_retrieve(map, identifier); new_process = 0; - /* Warn if requested connection does not exist */ - if (proc == NULL) - guacd_log(GUAC_LOG_INFO, "Connection \"%s\" does not exist.", - identifier); + /* Warn and ward off client if requested connection does not exist */ + if (proc == NULL) { + char message[2048]; + + snprintf(message, sizeof(message), + "Connection \"%s\" does not exist", identifier); + + guacd_log(GUAC_LOG_INFO, message); + guac_protocol_send_error(socket, message, + GUAC_PROTOCOL_STATUS_CLIENT_BAD_REQUEST); + } + else guacd_log(GUAC_LOG_INFO, "Joining existing connection \"%s\"", identifier); From a8cf250c9827ce7d974915deb82e50c1053badcd Mon Sep 17 00:00:00 2001 From: Tomer Gabel Date: Sun, 14 Feb 2021 16:21:54 +0200 Subject: [PATCH 2/3] GUACAMOLE-1047: Changed returned status code per review --- src/guacd/connection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/guacd/connection.c b/src/guacd/connection.c index 2cf3d291..0350dfbd 100644 --- a/src/guacd/connection.c +++ b/src/guacd/connection.c @@ -287,7 +287,7 @@ static int guacd_route_connection(guacd_proc_map* map, guac_socket* socket) { guacd_log(GUAC_LOG_INFO, message); guac_protocol_send_error(socket, message, - GUAC_PROTOCOL_STATUS_CLIENT_BAD_REQUEST); + GUAC_PROTOCOL_STATUS_RESOURCE_NOT_FOUND); } else From daa052398e31b3ad3f9aecbdb14e3cb417f82c11 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 18 Dec 2021 15:13:10 -0800 Subject: [PATCH 3/3] GUACAMOLE-1047: Remove unnecessary use of snprintf() in favor of guacd_log(). --- src/guacd/connection.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/guacd/connection.c b/src/guacd/connection.c index 0350dfbd..a5b98adf 100644 --- a/src/guacd/connection.c +++ b/src/guacd/connection.c @@ -280,13 +280,8 @@ static int guacd_route_connection(guacd_proc_map* map, guac_socket* socket) { /* Warn and ward off client if requested connection does not exist */ if (proc == NULL) { - char message[2048]; - - snprintf(message, sizeof(message), - "Connection \"%s\" does not exist", identifier); - - guacd_log(GUAC_LOG_INFO, message); - guac_protocol_send_error(socket, message, + guacd_log(GUAC_LOG_INFO, "Connection \"%s\" does not exist", identifier); + guac_protocol_send_error(socket, "No such connection.", GUAC_PROTOCOL_STATUS_RESOURCE_NOT_FOUND); }