Skip to content

Commit

Permalink
GUACAMOLE-381: Disable or ignore outbound clipboard transfers for VNC…
Browse files Browse the repository at this point in the history
…/RDP if "disable-copy" is set.
  • Loading branch information
mike-jumper committed Feb 19, 2019
1 parent 993d5c5 commit 2546155
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/protocols/rdp/rdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,13 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
guac_rdp_audio_load_plugin(instance->context, dvc_list);
}

/* Load clipboard plugin */
if (freerdp_channels_load_plugin(channels, instance->settings,
"cliprdr", NULL))
/* Load clipboard plugin if not disabled */
if (!(settings->disable_copy && settings->disable_paste)
&& freerdp_channels_load_plugin(channels, instance->settings,
"cliprdr", NULL)) {
guac_client_log(client, GUAC_LOG_WARNING,
"Failed to load cliprdr plugin. Clipboard will not work.");
}

/* If RDPSND/RDPDR required, load them */
if (settings->printing_enabled
Expand Down
4 changes: 4 additions & 0 deletions src/protocols/rdp/rdp_cliprdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ void guac_rdp_process_cb_data_response(guac_client* client,
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
char received_data[GUAC_RDP_CLIPBOARD_MAX_LENGTH];

/* Ignore received text if outbound clipboard transfer is disabled */
if (rdp_client->settings->disable_copy)
return;

guac_iconv_read* reader;
const char* input = (char*) event->data;
char* output = received_data;
Expand Down
4 changes: 4 additions & 0 deletions src/protocols/vnc/clipboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ void guac_vnc_cut_text(rfbClient* client, const char* text, int textlen) {
guac_client* gc = rfbClientGetClientData(client, GUAC_VNC_CLIENT_KEY);
guac_vnc_client* vnc_client = (guac_vnc_client*) gc->data;

/* Ignore received text if outbound clipboard transfer is disabled */
if (vnc_client->settings->disable_copy)
return;

char received_data[GUAC_VNC_CLIPBOARD_MAX_LENGTH];

const char* input = text;
Expand Down

0 comments on commit 2546155

Please sign in to comment.