GUAC-1164: Do not send clipboard notification to RDP server if RDP server is not connected.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/0fb8a49e Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/0fb8a49e Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/0fb8a49e Branch: refs/heads/master Commit: 0fb8a49e62c3d71dab11cc25acf0ef16bf42f972 Parents: 7c3d108 Author: Michael Jumper <[email protected]> Authored: Thu Mar 17 18:06:23 2016 -0700 Committer: Michael Jumper <[email protected]> Committed: Thu Mar 17 18:06:23 2016 -0700 ---------------------------------------------------------------------- src/protocols/rdp/rdp_stream.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/0fb8a49e/src/protocols/rdp/rdp_stream.c ---------------------------------------------------------------------- diff --git a/src/protocols/rdp/rdp_stream.c b/src/protocols/rdp/rdp_stream.c index 2bc39dd..f941529 100644 --- a/src/protocols/rdp/rdp_stream.c +++ b/src/protocols/rdp/rdp_stream.c @@ -286,24 +286,31 @@ int guac_rdp_clipboard_end_handler(guac_user* user, guac_stream* stream) { guac_client* client = user->client; guac_rdp_client* rdp_client = (guac_rdp_client*) client->data; - rdpChannels* channels = rdp_client->rdp_inst->context->channels; - - RDP_CB_FORMAT_LIST_EVENT* format_list = - (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new( - CliprdrChannel_Class, - CliprdrChannel_FormatList, - NULL, NULL); /* Terminate clipboard data with NULL */ guac_common_clipboard_append(rdp_client->clipboard, "", 1); - /* Notify server that text data is now available */ - format_list->formats = (UINT32*) malloc(sizeof(UINT32) * 2); - format_list->formats[0] = CB_FORMAT_TEXT; - format_list->formats[1] = CB_FORMAT_UNICODETEXT; - format_list->num_formats = 2; + /* 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*) freerdp_event_new( + CliprdrChannel_Class, + CliprdrChannel_FormatList, + NULL, NULL); - freerdp_channels_send_event(channels, (wMessage*) format_list); + /* Notify server that text data is now available */ + format_list->formats = (UINT32*) malloc(sizeof(UINT32) * 2); + format_list->formats[0] = CB_FORMAT_TEXT; + format_list->formats[1] = CB_FORMAT_UNICODETEXT; + format_list->num_formats = 2; + + freerdp_channels_send_event(channels, (wMessage*) format_list); + + } return 0; }
