Skip to content
Draft
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
8 changes: 8 additions & 0 deletions src/protocols/rdp/rdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,14 @@ void* guac_rdp_client_thread(void* data) {
!settings->recording_exclude_touch,
settings->recording_include_keys,
settings->recording_write_existing);

/* If recording is required but failed, abort the connection */
if (rdp_client->recording == NULL && settings->require_recording) {
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
"Session recording is required but could not be created. "
"Aborting connection.");
return NULL;
}
}

/* Continue handling connections until error or client disconnect */
Expand Down
12 changes: 12 additions & 0 deletions src/protocols/rdp/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const char* GUAC_RDP_CLIENT_ARGS[] = {
"recording-include-keys",
"create-recording-path",
"recording-write-existing",
"require-recording",
"resize-method",
"enable-audio-input",
"enable-touch",
Expand Down Expand Up @@ -593,6 +594,12 @@ enum RDP_ARGS_IDX {
*/
IDX_RECORDING_WRITE_EXISTING,

/**
* Whether recording is required. If set to "true", the connection will
* be closed if the recording cannot be created for any reason.
*/
IDX_REQUIRE_RECORDING,

/**
* The method to use to apply screen size changes requested by the user.
* Valid values are blank, "display-update", and "reconnect".
Expand Down Expand Up @@ -1216,6 +1223,11 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
guac_user_parse_args_boolean(user, GUAC_RDP_CLIENT_ARGS, argv,
IDX_RECORDING_WRITE_EXISTING, 0);

/* Parse require recording flag */
settings->require_recording =
guac_user_parse_args_boolean(user, GUAC_RDP_CLIENT_ARGS, argv,
IDX_REQUIRE_RECORDING, 0);

/* No resize method */
if (strcmp(argv[IDX_RESIZE_METHOD], "") == 0) {
guac_user_log(user, GUAC_LOG_INFO, "Resize method: none");
Expand Down
7 changes: 7 additions & 0 deletions src/protocols/rdp/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,13 @@ typedef struct guac_rdp_settings {
*/
int recording_write_existing;

/**
* Non-zero if the connection should be closed when a recording cannot be
* created. Zero by default, meaning the connection will proceed even if
* recording fails.
*/
int require_recording;

/**
* The method to apply when the user's display changes size.
*/
Expand Down
12 changes: 12 additions & 0 deletions src/protocols/ssh/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const char* GUAC_SSH_CLIENT_ARGS[] = {
"recording-include-keys",
"create-recording-path",
"recording-write-existing",
"require-recording",
"read-only",
"server-alive-interval",
"backspace",
Expand Down Expand Up @@ -266,6 +267,12 @@ enum SSH_ARGS_IDX {
*/
IDX_RECORDING_WRITE_EXISTING,

/**
* Whether recording is required. If set to "true", the connection will
* be closed if the recording cannot be created for any reason.
*/
IDX_REQUIRE_RECORDING,

/**
* "true" if this connection should be read-only (user input should be
* dropped), "false" or blank otherwise.
Expand Down Expand Up @@ -546,6 +553,11 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user,
guac_user_parse_args_boolean(user, GUAC_SSH_CLIENT_ARGS, argv,
IDX_RECORDING_WRITE_EXISTING, false);

/* Parse require recording flag */
settings->require_recording =
guac_user_parse_args_boolean(user, GUAC_SSH_CLIENT_ARGS, argv,
IDX_REQUIRE_RECORDING, false);

/* Parse server alive interval */
settings->server_alive_interval =
guac_user_parse_args_int(user, GUAC_SSH_CLIENT_ARGS, argv,
Expand Down
7 changes: 7 additions & 0 deletions src/protocols/ssh/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,13 @@ typedef struct guac_ssh_settings {
*/
bool recording_write_existing;

/**
* Non-zero if the connection should be closed when a recording cannot be
* created. Zero by default, meaning the connection will proceed even if
* recording fails.
*/
bool require_recording;
Comment on lines +281 to +286
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You use "zero" but are using a bool here (instead of int as in the RDP code). It should probably be both consistent and the language in the comments should match the type used.


/**
* The number of seconds between sending server alive messages.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/protocols/ssh/ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,14 @@ void* ssh_client_thread(void* data) {
0, /* Touch events not supported */
settings->recording_include_keys,
settings->recording_write_existing);

/* If recording is required but failed, abort the connection */
if (ssh_client->recording == NULL && settings->require_recording) {
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
"Session recording is required but could not be created. "
"Aborting connection.");
return NULL;
}
}

/* Create terminal options with required parameters */
Expand Down
12 changes: 12 additions & 0 deletions src/protocols/telnet/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const char* GUAC_TELNET_CLIENT_ARGS[] = {
"recording-include-keys",
"create-recording-path",
"recording-write-existing",
"require-recording",
"read-only",
"backspace",
"func-keys-and-keypad",
Expand Down Expand Up @@ -212,6 +213,12 @@ enum TELNET_ARGS_IDX {
*/
IDX_RECORDING_WRITE_EXISTING,

/**
* Whether recording is required. If set to "true", the connection will
* be closed if the recording cannot be created for any reason.
*/
IDX_REQUIRE_RECORDING,

/**
* "true" if this connection should be read-only (user input should be
* dropped), "false" or blank otherwise.
Expand Down Expand Up @@ -526,6 +533,11 @@ guac_telnet_settings* guac_telnet_parse_args(guac_user* user,
guac_user_parse_args_boolean(user, GUAC_TELNET_CLIENT_ARGS, argv,
IDX_RECORDING_WRITE_EXISTING, false);

/* Parse require recording flag */
settings->require_recording =
guac_user_parse_args_boolean(user, GUAC_TELNET_CLIENT_ARGS, argv,
IDX_REQUIRE_RECORDING, false);

/* Parse backspace key code */
settings->backspace =
guac_user_parse_args_int(user, GUAC_TELNET_CLIENT_ARGS, argv,
Expand Down
7 changes: 7 additions & 0 deletions src/protocols/telnet/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ typedef struct guac_telnet_settings {
*/
bool recording_write_existing;

/**
* Non-zero if the connection should be closed when a recording cannot be
* created. Zero by default, meaning the connection will proceed even if
* recording fails.
*/
bool require_recording;

/**
* The ASCII code, as an integer, that the telnet client will use when the
* backspace key is pressed. By default, this is 127, ASCII delete, if
Expand Down
8 changes: 8 additions & 0 deletions src/protocols/telnet/telnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,14 @@ void* guac_telnet_client_thread(void* data) {
0, /* Touch events not supported */
settings->recording_include_keys,
settings->recording_write_existing);

/* If recording is required but failed, abort the connection */
if (telnet_client->recording == NULL && settings->require_recording) {
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
"Session recording is required but could not be created. "
"Aborting connection.");
return NULL;
}
}

/* Create terminal options with required parameters */
Expand Down
12 changes: 12 additions & 0 deletions src/protocols/vnc/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const char* GUAC_VNC_CLIENT_ARGS[] = {
"recording-include-keys",
"create-recording-path",
"recording-write-existing",
"require-recording",
"clipboard-buffer-size",
"disable-copy",
"disable-paste",
Expand Down Expand Up @@ -367,6 +368,12 @@ enum VNC_ARGS_IDX {
*/
IDX_RECORDING_WRITE_EXISTING,

/**
* Whether recording is required. If set to "true", the connection will
* be closed if the recording cannot be created for any reason.
*/
IDX_REQUIRE_RECORDING,

/**
* The maximum number of bytes to allow within the clipboard.
*/
Expand Down Expand Up @@ -688,6 +695,11 @@ guac_vnc_settings* guac_vnc_parse_args(guac_user* user,
guac_user_parse_args_boolean(user, GUAC_VNC_CLIENT_ARGS, argv,
IDX_RECORDING_WRITE_EXISTING, false);

/* Parse require recording flag */
settings->require_recording =
guac_user_parse_args_boolean(user, GUAC_VNC_CLIENT_ARGS, argv,
IDX_REQUIRE_RECORDING, false);

/* Parse clipboard copy disable flag */
settings->disable_copy =
guac_user_parse_args_boolean(user, GUAC_VNC_CLIENT_ARGS, argv,
Expand Down
7 changes: 7 additions & 0 deletions src/protocols/vnc/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,13 @@ typedef struct guac_vnc_settings {
* Disabled by default.
*/
bool recording_write_existing;

/**
* Non-zero if the connection should be closed when a recording cannot be
* created. Zero by default, meaning the connection will proceed even if
* recording fails.
*/
bool require_recording;

/**
* Whether or not to send the magic Wake-on-LAN (WoL) packet prior to
Expand Down
8 changes: 8 additions & 0 deletions src/protocols/vnc/vnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,14 @@ void* guac_vnc_client_thread(void* data) {
0, /* Touch events not supported */
settings->recording_include_keys,
settings->recording_write_existing);

/* If recording is required but failed, abort the connection */
if (vnc_client->recording == NULL && settings->require_recording) {
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
"Session recording is required but could not be created. "
"Aborting connection.");
return NULL;
}
}

/* Create display */
Expand Down