From 4e68a260bb5ebc28ace38c204bfc1d6c031a27cf Mon Sep 17 00:00:00 2001 From: Stefan Feenstra Date: Tue, 19 Jan 2021 12:19:09 -0700 Subject: [PATCH] GUACAMOLE-1267: Add VNC setting 'disable-remote-input' --- src/protocols/vnc/settings.c | 13 +++++++++++++ src/protocols/vnc/settings.h | 5 +++++ src/protocols/vnc/vnc.c | 14 ++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/src/protocols/vnc/settings.c b/src/protocols/vnc/settings.c index 083a6c6331..dabe1dd287 100644 --- a/src/protocols/vnc/settings.c +++ b/src/protocols/vnc/settings.c @@ -87,6 +87,7 @@ const char* GUAC_VNC_CLIENT_ARGS[] = { "recording-write-existing", "disable-copy", "disable-paste", + "disable-server-input", "wol-send-packet", "wol-mac-addr", @@ -95,6 +96,7 @@ const char* GUAC_VNC_CLIENT_ARGS[] = { "wol-wait-time", "force-lossless", + NULL }; @@ -351,6 +353,12 @@ enum VNC_ARGS_IDX { * using the clipboard. By default, clipboard access is not blocked. */ IDX_DISABLE_PASTE, + + /* + * Whether or not to disable the input on the server side when the VNC client + * is connected. The default is not to disable the input. + */ + IDX_DISABLE_SERVER_INPUT, /** * Whether to send the magic Wake-on-LAN (WoL) packet to wake the remote @@ -443,6 +451,11 @@ guac_vnc_settings* guac_vnc_parse_args(guac_user* user, guac_user_parse_args_boolean(user, GUAC_VNC_CLIENT_ARGS, argv, IDX_READ_ONLY, false); + /* Disable server input */ + settings->disable_server_input = + guac_user_parse_args_boolean(user, GUAC_VNC_CLIENT_ARGS, argv, + IDX_DISABLE_SERVER_INPUT, false); + /* Parse color depth */ settings->color_depth = guac_user_parse_args_int(user, GUAC_VNC_CLIENT_ARGS, argv, diff --git a/src/protocols/vnc/settings.h b/src/protocols/vnc/settings.h index 3803434153..f118f8c3fe 100644 --- a/src/protocols/vnc/settings.h +++ b/src/protocols/vnc/settings.h @@ -311,6 +311,11 @@ typedef struct guac_vnc_settings { */ int wol_wait_time; + /** + * Whether or not to disable the input on the server side. + */ + bool disable_server_input; + } guac_vnc_settings; /** diff --git a/src/protocols/vnc/vnc.c b/src/protocols/vnc/vnc.c index 9fd9156a81..763e8708cb 100644 --- a/src/protocols/vnc/vnc.c +++ b/src/protocols/vnc/vnc.c @@ -416,6 +416,20 @@ void* guac_vnc_client_thread(void* data) { } #endif + /* Disable remote console (Server input) */ + if (settings->disable_server_input) { + rfbSetServerInputMsg msg; + msg.type = rfbSetServerInput; + msg.status = 1; + msg.pad = 0; + + if (WriteToRFBServer(rfb_client, (char*)&msg, sz_rfbSetServerInputMsg)) + guac_client_log(client, GUAC_LOG_DEBUG, "Successfully sent request to disable server input."); + + else + guac_client_log(client, GUAC_LOG_WARNING, "Failed to send request to disable server input."); + } + /* Set remaining client data */ vnc_client->rfb_client = rfb_client;