Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUACAMOLE-1267: Add VNC setting 'disable-remote-input' #501

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading