GUACAMOLE-5: Add "read-only" parameter to RDP, SSH, and telnet (per-user, just like VNC).
This commit is contained in:
parent
59e66ddc77
commit
1ad99a312e
@ -91,6 +91,7 @@ const char* GUAC_RDP_CLIENT_ARGS[] = {
|
|||||||
"create-recording-path",
|
"create-recording-path",
|
||||||
"resize-method",
|
"resize-method",
|
||||||
"enable-audio-input",
|
"enable-audio-input",
|
||||||
|
"read-only",
|
||||||
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
@ -385,6 +386,12 @@ enum RDP_ARGS_IDX {
|
|||||||
*/
|
*/
|
||||||
IDX_ENABLE_AUDIO_INPUT,
|
IDX_ENABLE_AUDIO_INPUT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "true" if this connection should be read-only (user input should be
|
||||||
|
* dropped), "false" or blank otherwise.
|
||||||
|
*/
|
||||||
|
IDX_READ_ONLY,
|
||||||
|
|
||||||
RDP_ARGS_COUNT
|
RDP_ARGS_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -528,6 +535,11 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
|
|||||||
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
|
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
|
||||||
IDX_PASSWORD, NULL);
|
IDX_PASSWORD, NULL);
|
||||||
|
|
||||||
|
/* Read-only mode */
|
||||||
|
settings->read_only =
|
||||||
|
guac_user_parse_args_boolean(user, GUAC_RDP_CLIENT_ARGS, argv,
|
||||||
|
IDX_READ_ONLY, 0);
|
||||||
|
|
||||||
/* Client name */
|
/* Client name */
|
||||||
settings->client_name =
|
settings->client_name =
|
||||||
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
|
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
|
||||||
|
@ -141,6 +141,11 @@ typedef struct guac_rdp_settings {
|
|||||||
*/
|
*/
|
||||||
char* password;
|
char* password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this connection is read-only, and user input should be dropped.
|
||||||
|
*/
|
||||||
|
int read_only;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color depth of the display to request, in bits.
|
* The color depth of the display to request, in bits.
|
||||||
*/
|
*/
|
||||||
|
@ -94,12 +94,24 @@ int guac_rdp_user_join_handler(guac_user* user, int argc, char** argv) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
user->file_handler = guac_rdp_user_file_handler;
|
/* Only handle events if not read-only */
|
||||||
user->mouse_handler = guac_rdp_user_mouse_handler;
|
if (!settings->read_only) {
|
||||||
user->key_handler = guac_rdp_user_key_handler;
|
|
||||||
user->size_handler = guac_rdp_user_size_handler;
|
/* General mouse/keyboard/clipboard events */
|
||||||
user->pipe_handler = guac_rdp_svc_pipe_handler;
|
user->mouse_handler = guac_rdp_user_mouse_handler;
|
||||||
user->clipboard_handler = guac_rdp_clipboard_handler;
|
user->key_handler = guac_rdp_user_key_handler;
|
||||||
|
user->clipboard_handler = guac_rdp_clipboard_handler;
|
||||||
|
|
||||||
|
/* Display size change events */
|
||||||
|
user->size_handler = guac_rdp_user_size_handler;
|
||||||
|
|
||||||
|
/* Set generic (non-filesystem) file upload handler */
|
||||||
|
user->file_handler = guac_rdp_user_file_handler;
|
||||||
|
|
||||||
|
/* Inbound arbitrary named pipes */
|
||||||
|
user->pipe_handler = guac_rdp_svc_pipe_handler;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ const char* GUAC_SSH_CLIENT_ARGS[] = {
|
|||||||
"recording-path",
|
"recording-path",
|
||||||
"recording-name",
|
"recording-name",
|
||||||
"create-recording-path",
|
"create-recording-path",
|
||||||
|
"read-only",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -158,6 +159,12 @@ enum SSH_ARGS_IDX {
|
|||||||
*/
|
*/
|
||||||
IDX_CREATE_RECORDING_PATH,
|
IDX_CREATE_RECORDING_PATH,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "true" if this connection should be read-only (user input should be
|
||||||
|
* dropped), "false" or blank otherwise.
|
||||||
|
*/
|
||||||
|
IDX_READ_ONLY,
|
||||||
|
|
||||||
SSH_ARGS_COUNT
|
SSH_ARGS_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -232,6 +239,11 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user,
|
|||||||
guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv,
|
guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv,
|
||||||
IDX_PORT, GUAC_SSH_DEFAULT_PORT);
|
IDX_PORT, GUAC_SSH_DEFAULT_PORT);
|
||||||
|
|
||||||
|
/* Read-only mode */
|
||||||
|
settings->read_only =
|
||||||
|
guac_user_parse_args_boolean(user, GUAC_SSH_CLIENT_ARGS, argv,
|
||||||
|
IDX_READ_ONLY, false);
|
||||||
|
|
||||||
/* Read command, if any */
|
/* Read command, if any */
|
||||||
settings->command =
|
settings->command =
|
||||||
guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv,
|
guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv,
|
||||||
|
@ -94,6 +94,11 @@ typedef struct guac_ssh_settings {
|
|||||||
*/
|
*/
|
||||||
char* key_passphrase;
|
char* key_passphrase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this connection is read-only, and user input should be dropped.
|
||||||
|
*/
|
||||||
|
bool read_only;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The command to run instead of the default shell. If a normal shell
|
* The command to run instead of the default shell. If a normal shell
|
||||||
* session is desired, this will be NULL.
|
* session is desired, this will be NULL.
|
||||||
|
@ -75,14 +75,21 @@ int guac_ssh_user_join_handler(guac_user* user, int argc, char** argv) {
|
|||||||
guac_socket_flush(user->socket);
|
guac_socket_flush(user->socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set per-user event handlers */
|
/* Only handle events if not read-only */
|
||||||
user->key_handler = guac_ssh_user_key_handler;
|
if (!settings->read_only) {
|
||||||
user->mouse_handler = guac_ssh_user_mouse_handler;
|
|
||||||
user->size_handler = guac_ssh_user_size_handler;
|
|
||||||
user->clipboard_handler = guac_ssh_clipboard_handler;
|
|
||||||
|
|
||||||
/* Set generic (non-filesystem) file upload handler */
|
/* General mouse/keyboard/clipboard events */
|
||||||
user->file_handler = guac_sftp_file_handler;
|
user->key_handler = guac_ssh_user_key_handler;
|
||||||
|
user->mouse_handler = guac_ssh_user_mouse_handler;
|
||||||
|
user->clipboard_handler = guac_ssh_clipboard_handler;
|
||||||
|
|
||||||
|
/* Display size change events */
|
||||||
|
user->size_handler = guac_ssh_user_size_handler;
|
||||||
|
|
||||||
|
/* Set generic (non-filesystem) file upload handler */
|
||||||
|
user->file_handler = guac_sftp_file_handler;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ const char* GUAC_TELNET_CLIENT_ARGS[] = {
|
|||||||
"recording-path",
|
"recording-path",
|
||||||
"recording-name",
|
"recording-name",
|
||||||
"create-recording-path",
|
"create-recording-path",
|
||||||
|
"read-only",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -138,6 +139,12 @@ enum TELNET_ARGS_IDX {
|
|||||||
*/
|
*/
|
||||||
IDX_CREATE_RECORDING_PATH,
|
IDX_CREATE_RECORDING_PATH,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "true" if this connection should be read-only (user input should be
|
||||||
|
* dropped), "false" or blank otherwise.
|
||||||
|
*/
|
||||||
|
IDX_READ_ONLY,
|
||||||
|
|
||||||
TELNET_ARGS_COUNT
|
TELNET_ARGS_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -217,6 +224,11 @@ guac_telnet_settings* guac_telnet_parse_args(guac_user* user,
|
|||||||
IDX_PASSWORD_REGEX, GUAC_TELNET_DEFAULT_PASSWORD_REGEX));
|
IDX_PASSWORD_REGEX, GUAC_TELNET_DEFAULT_PASSWORD_REGEX));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Read-only mode */
|
||||||
|
settings->read_only =
|
||||||
|
guac_user_parse_args_boolean(user, GUAC_TELNET_CLIENT_ARGS, argv,
|
||||||
|
IDX_READ_ONLY, false);
|
||||||
|
|
||||||
/* Read font name */
|
/* Read font name */
|
||||||
settings->font_name =
|
settings->font_name =
|
||||||
guac_user_parse_args_string(user, GUAC_TELNET_CLIENT_ARGS, argv,
|
guac_user_parse_args_string(user, GUAC_TELNET_CLIENT_ARGS, argv,
|
||||||
|
@ -112,6 +112,11 @@ typedef struct guac_telnet_settings {
|
|||||||
*/
|
*/
|
||||||
regex_t* password_regex;
|
regex_t* password_regex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this connection is read-only, and user input should be dropped.
|
||||||
|
*/
|
||||||
|
bool read_only;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the font to use for display rendering.
|
* The name of the font to use for display rendering.
|
||||||
*/
|
*/
|
||||||
|
@ -74,11 +74,18 @@ int guac_telnet_user_join_handler(guac_user* user, int argc, char** argv) {
|
|||||||
guac_socket_flush(user->socket);
|
guac_socket_flush(user->socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set per-user event handlers */
|
/* Only handle events if not read-only */
|
||||||
user->key_handler = guac_telnet_user_key_handler;
|
if (!settings->read_only) {
|
||||||
user->mouse_handler = guac_telnet_user_mouse_handler;
|
|
||||||
user->size_handler = guac_telnet_user_size_handler;
|
/* General mouse/keyboard/clipboard events */
|
||||||
user->clipboard_handler = guac_telnet_clipboard_handler;
|
user->key_handler = guac_telnet_user_key_handler;
|
||||||
|
user->mouse_handler = guac_telnet_user_mouse_handler;
|
||||||
|
user->clipboard_handler = guac_telnet_clipboard_handler;
|
||||||
|
|
||||||
|
/* Display size change events */
|
||||||
|
user->size_handler = guac_telnet_user_size_handler;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user