GUAC-1164: Do not send clipboard notification to RDP server if RDP server is not connected.

This commit is contained in:
Michael Jumper 2016-03-17 18:06:23 -07:00
parent 7c3d108e21
commit 0fb8a49e62

View File

@ -286,7 +286,15 @@ int guac_rdp_clipboard_end_handler(guac_user* user, guac_stream* stream) {
guac_client* client = user->client; guac_client* client = user->client;
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data; guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
rdpChannels* channels = rdp_client->rdp_inst->context->channels;
/* Terminate clipboard data with NULL */
guac_common_clipboard_append(rdp_client->clipboard, "", 1);
/* Notify RDP server of new data, if connected */
freerdp* rdp_inst = rdp_client->rdp_inst;
if (rdp_inst != NULL) {
rdpChannels* channels = rdp_inst->context->channels;
RDP_CB_FORMAT_LIST_EVENT* format_list = RDP_CB_FORMAT_LIST_EVENT* format_list =
(RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new( (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(
@ -294,9 +302,6 @@ int guac_rdp_clipboard_end_handler(guac_user* user, guac_stream* stream) {
CliprdrChannel_FormatList, CliprdrChannel_FormatList,
NULL, NULL); NULL, NULL);
/* Terminate clipboard data with NULL */
guac_common_clipboard_append(rdp_client->clipboard, "", 1);
/* Notify server that text data is now available */ /* Notify server that text data is now available */
format_list->formats = (UINT32*) malloc(sizeof(UINT32) * 2); format_list->formats = (UINT32*) malloc(sizeof(UINT32) * 2);
format_list->formats[0] = CB_FORMAT_TEXT; format_list->formats[0] = CB_FORMAT_TEXT;
@ -305,6 +310,8 @@ int guac_rdp_clipboard_end_handler(guac_user* user, guac_stream* stream) {
freerdp_channels_send_event(channels, (wMessage*) format_list); freerdp_channels_send_event(channels, (wMessage*) format_list);
}
return 0; return 0;
} }