Skip to content

Commit

Permalink
GUACAMOLE-1267: Add VNC setting 'disable-remote-input'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-esq authored and necouchman committed Apr 5, 2024
1 parent f9d9dff commit 4e68a26
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/protocols/vnc/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -95,6 +96,7 @@ const char* GUAC_VNC_CLIENT_ARGS[] = {
"wol-wait-time",

"force-lossless",

NULL
};

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions src/protocols/vnc/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
14 changes: 14 additions & 0 deletions src/protocols/vnc/vnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 4e68a26

Please sign in to comment.