From 6a50d3076c1db9c35dca246d65e669a72ccd883a Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 20 Jun 2020 14:14:29 -0700 Subject: [PATCH 1/4] GUACAMOLE-1076: Set RAIL flag for expanding environment variables within RemoteApp arguments (match v1.0.0 behavior). --- src/protocols/rdp/channels/rail.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/protocols/rdp/channels/rail.c b/src/protocols/rdp/channels/rail.c index 6a94eda0..055496f5 100644 --- a/src/protocols/rdp/channels/rail.c +++ b/src/protocols/rdp/channels/rail.c @@ -104,6 +104,7 @@ static UINT guac_rdp_rail_complete_handshake(RailClientContext* rail) { return status; RAIL_EXEC_ORDER exec = { + .flags = RAIL_EXEC_FLAG_EXPAND_ARGUMENTS, .RemoteApplicationProgram = rdp_client->settings->remote_app, .RemoteApplicationWorkingDir = rdp_client->settings->remote_app_dir, .RemoteApplicationArguments = rdp_client->settings->remote_app_args, From a7732e72bed6c3f7d07aa9974c235e97257b49a0 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 20 Jun 2020 14:30:39 -0700 Subject: [PATCH 2/4] GUACAMOLE-1076: Ensure Client Information PDU is sent during RAIL handshake (required by spec). --- src/protocols/rdp/channels/rail.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/protocols/rdp/channels/rail.c b/src/protocols/rdp/channels/rail.c index 055496f5..095d4306 100644 --- a/src/protocols/rdp/channels/rail.c +++ b/src/protocols/rdp/channels/rail.c @@ -49,13 +49,15 @@ /** * Completes initialization of the RemoteApp session, responding to the server - * handshake, sending client system parameters, and executing the desired - * RemoteApp command. This is accomplished using the Handshake PDU, Client - * System Parameters Update PDU, and Client Execute PDU respectively. These - * PDUs MUST be sent for the desired RemoteApp to run, and MUST NOT be sent - * until after a Handshake or HandshakeEx PDU has been received. See: + * handshake, sending client status and system parameters, and executing the + * desired RemoteApp command. This is accomplished using the Handshake PDU, + * Client Information PDU, one or more Client System Parameters Update PDUs, + * and the Client Execute PDU respectively. These PDUs MUST be sent for the + * desired RemoteApp to run, and MUST NOT be sent until after a Handshake or + * HandshakeEx PDU has been received. See: * * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdperp/cec4eb83-b304-43c9-8378-b5b8f5e7082a (Handshake PDU) + * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdperp/743e782d-f59b-40b5-a0f3-adc74e68a2ff (Client Information PDU) * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdperp/60344497-883f-4711-8b9a-828d1c580195 (System Parameters Update PDU) * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdperp/98a6e3c3-c2a9-42cc-ad91-0d9a6c211138 (Client Execute PDU) * @@ -88,6 +90,15 @@ static UINT guac_rdp_rail_complete_handshake(RailClientContext* rail) { if (status != CHANNEL_RC_OK) return status; + RAIL_CLIENT_STATUS_ORDER client_status = { + .flags = 0x00 + }; + + /* Send client status */ + status = rail->ClientInformation(rail, &client_status); + if (status != CHANNEL_RC_OK) + return status; + RAIL_SYSPARAM_ORDER sysparam = { .workArea = { .left = 0, From d5608fb8a2887946b33ad8c861a6fb4b3211cdc0 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 20 Jun 2020 15:09:00 -0700 Subject: [PATCH 3/4] GUACAMOLE-1076: Send same System Parameters Update PDUs as Apache Guacamole 1.0.0 and older. --- src/protocols/rdp/channels/rail.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/protocols/rdp/channels/rail.c b/src/protocols/rdp/channels/rail.c index 095d4306..c8936d6c 100644 --- a/src/protocols/rdp/channels/rail.c +++ b/src/protocols/rdp/channels/rail.c @@ -100,13 +100,36 @@ static UINT guac_rdp_rail_complete_handshake(RailClientContext* rail) { return status; RAIL_SYSPARAM_ORDER sysparam = { + + .dragFullWindows = FALSE, + + .highContrast = { + .flags = 0x7E, + .colorScheme = { + .string = NULL, + .length = 0 + } + }, + + .keyboardCues = FALSE, + .keyboardPref = FALSE, + .mouseButtonSwap = FALSE, + .workArea = { .left = 0, .top = 0, .right = rdp_client->settings->width, .bottom = rdp_client->settings->height }, - .dragFullWindows = FALSE + + .params = + SPI_MASK_SET_DRAG_FULL_WINDOWS + | SPI_MASK_SET_HIGH_CONTRAST + | SPI_MASK_SET_KEYBOARD_CUES + | SPI_MASK_SET_KEYBOARD_PREF + | SPI_MASK_SET_MOUSE_BUTTON_SWAP + | SPI_MASK_SET_WORK_AREA + }; /* Send client system parameters */ From 7598f5a95a0c7bcc8419890e41abfdb2094f1d9b Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 20 Jun 2020 16:09:43 -0700 Subject: [PATCH 4/4] GUACAMOLE-1076: Use proper constants to represent RemoteApp high contrast support flags. --- src/protocols/rdp/channels/rail.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/protocols/rdp/channels/rail.c b/src/protocols/rdp/channels/rail.c index c8936d6c..5f105c8e 100644 --- a/src/protocols/rdp/channels/rail.c +++ b/src/protocols/rdp/channels/rail.c @@ -104,7 +104,13 @@ static UINT guac_rdp_rail_complete_handshake(RailClientContext* rail) { .dragFullWindows = FALSE, .highContrast = { - .flags = 0x7E, + .flags = + HCF_AVAILABLE + | HCF_CONFIRMHOTKEY + | HCF_HOTKEYACTIVE + | HCF_HOTKEYAVAILABLE + | HCF_HOTKEYSOUND + | HCF_INDICATOR, .colorScheme = { .string = NULL, .length = 0