Skip to content

Commit

Permalink
GUACAMOLE-1267: Merge VNC parameter for disabling local input on VNC …
Browse files Browse the repository at this point in the history
…server.
  • Loading branch information
mike-jumper committed May 2, 2024
2 parents fe808ce + 721e666 commit 3ad3b04
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
12 changes: 12 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 Down Expand Up @@ -353,6 +354,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 @@ -457,6 +464,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 @@ -321,6 +321,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 3ad3b04

Please sign in to comment.