From bced87cff991f50c4944c5c38b525c702bdaa2d5 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 25 Dec 2019 01:34:57 -0800 Subject: [PATCH] GUACAMOLE-249: FreeRDP 2.0.0 requires the Clipboard Capabilities PDU to be manually sent. --- src/protocols/rdp/channels/cliprdr.c | 33 +++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/protocols/rdp/channels/cliprdr.c b/src/protocols/rdp/channels/cliprdr.c index fc0e31eb..4350455d 100644 --- a/src/protocols/rdp/channels/cliprdr.c +++ b/src/protocols/rdp/channels/cliprdr.c @@ -76,6 +76,36 @@ static UINT guac_rdp_cliprdr_send_format_list(CliprdrClientContext* cliprdr) { } +/** + * Sends a Clipboard Capabilities PDU to the RDP server describing the features + * of the CLIPRDR channel that are supported by the client. + * + * @param cliprdr + * The CliprdrClientContext structure used by FreeRDP to handle the + * CLIPRDR channel for the current RDP session. + * + * @return + * CHANNEL_RC_OK (zero) if the Clipboard Capabilities PDU was sent + * successfully, an error code (non-zero) otherwise. + */ +static UINT guac_rdp_cliprdr_send_capabilities(CliprdrClientContext* cliprdr) { + + CLIPRDR_GENERAL_CAPABILITY_SET cap_set = { + .capabilitySetType = CB_CAPSTYPE_GENERAL, /* CLIPRDR specification requires that this is CB_CAPSTYPE_GENERAL, the only defined set type */ + .capabilitySetLength = 12, /* The size of the capability set within the PDU - for CB_CAPSTYPE_GENERAL, this is ALWAYS 12 bytes */ + .version = CB_CAPS_VERSION_2, /* The version of the CLIPRDR specification supported */ + .generalFlags = CB_USE_LONG_FORMAT_NAMES /* Bitwise OR of all supported feature flags */ + }; + + CLIPRDR_CAPABILITIES caps = { + .cCapabilitiesSets = 1, + .capabilitySets = (CLIPRDR_CAPABILITY_SET*) &cap_set + }; + + return cliprdr->ClientCapabilities(cliprdr, &caps); + +} + /** * Callback invoked by the FreeRDP CLIPRDR plugin for received Monitor Ready * PDUs. The Monitor Ready PDU is sent by the RDP server only during @@ -107,7 +137,8 @@ static UINT guac_rdp_cliprdr_monitor_ready(CliprdrClientContext* cliprdr, guac_client_log(clipboard->client, GUAC_LOG_TRACE, "CLIPRDR: Received " "monitor ready."); - /* Respond with supported format list */ + /* Respond with capabilities and supported format list */ + guac_rdp_cliprdr_send_capabilities(cliprdr); return guac_rdp_cliprdr_send_format_list(cliprdr); }