diff -Nru freerdp2-2.3.0+dfsg1/debian/changelog freerdp2-2.3.0+dfsg1/debian/changelog --- freerdp2-2.3.0+dfsg1/debian/changelog 2021-02-25 15:14:52.000000000 +0000 +++ freerdp2-2.3.0+dfsg1/debian/changelog 2021-05-16 21:42:19.000000000 +0000 @@ -1,3 +1,39 @@ +freerdp2 (2.3.0+dfsg1-2) unstable; urgency=medium + + * debian/watch: + + Fix Github watch URL. + * debian/patches: + + Backport changes from 2.3.2 (bound checks, API compat fixes, Smartcard + issues fixes, etc.). + - 0001-Added-compatibility-define.patch + - 0003-Reverted-connectErrorCode-removal.patch + - 0004-Fixed-a-leak-on-mouse-cursor-updates.patch + - 0007-Fixed-format-string-in-smartcard_trace_state_return.patch + - 0008-Fixed-linking-dependencies-for-client-geometry-chann.patch + - 0010-Fixed-smartcard_convert_string_list-with-0-length.patch + - 0012-Parse-on-a-copy-of-the-argument-string-for-printer.patch + - 0015-Fix-xf_Pointer_SetPosition-with-smart-sizing.patch + - 0017-Backported-6865-Disable-websockets-command-line-opti.patch + - 0019-Check-smartcard_convert_string_list-for-NULL-string.patch + - 0020-Use-specific-names-for-drive-hotplug-special-values.patch + - 0021-Filter-RDPDR-types-other-than-drives-on-windows-hotp.patch + - 0023-use-tlsOut-BIO-when-using-websocket-in-rdg_bio_ctrl.patch + - 0024-Added-bounds-checks-to-gfx-commands.patch + - 0025-Added-bounds-check-in-rdpgfx_recv_wire_to_surface_1_.patch + - 0026-Added-fuzzying-test-for-planar-decoder.patch + - 0027-Added-missing-bounds-check.patch + - 0028-Fixed-mac-issues-with-smartcard-context-cleanup-6890.patch + - 0031-Fix-monitor-list.patch + - 0032-Fixed-CodeQL-warnings.patch + - 0033-Reverted-winpr_BinToHexString-argument-change.patch + * debian/patches: + + Add 0034-Fixed-6938-Remote-app-mode-clipboard-fix.patch. In remote app + mode the _FREERDP_TIMESTAMP_PROPERTY does not work. Therefore ignore it. + + Add 0035-Fixed-6989-Use-X509_STORE_set_default_paths.patch. Fix Windows + 10 logon when using an internal trusted root CA. + + -- Mike Gabriel Sun, 16 May 2021 23:42:19 +0200 + freerdp2 (2.3.0+dfsg1-1) unstable; urgency=medium [ Fabio Fantoni ] diff -Nru freerdp2-2.3.0+dfsg1/debian/patches/0001-Added-compatibility-define.patch freerdp2-2.3.0+dfsg1/debian/patches/0001-Added-compatibility-define.patch --- freerdp2-2.3.0+dfsg1/debian/patches/0001-Added-compatibility-define.patch 1970-01-01 00:00:00.000000000 +0000 +++ freerdp2-2.3.0+dfsg1/debian/patches/0001-Added-compatibility-define.patch 2021-04-29 09:57:14.000000000 +0000 @@ -0,0 +1,24 @@ +From 1ff1906545bacb3eb7608155984dd4642647b736 Mon Sep 17 00:00:00 2001 +From: akallabeth +Date: Sat, 27 Feb 2021 08:29:46 +0100 +Subject: [PATCH 01/36] Added compatibility define + +--- + winpr/include/winpr/shell.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/winpr/include/winpr/shell.h b/winpr/include/winpr/shell.h +index 72931a01b..f88291e43 100644 +--- a/winpr/include/winpr/shell.h ++++ b/winpr/include/winpr/shell.h +@@ -86,6 +86,7 @@ typedef enum + + /* Deprecated, here for compatibility */ + #define FD_SHOWPROGRESSUI FD_PROGRESSUI ++#define FD_WRITESTIME FD_WRITETIME + + /* FILEDESCRIPTOR.dwFileAttributes */ + #define FILE_ATTRIBUTE_READONLY 0x00000001 +-- +2.30.2 + diff -Nru freerdp2-2.3.0+dfsg1/debian/patches/0003-Reverted-connectErrorCode-removal.patch freerdp2-2.3.0+dfsg1/debian/patches/0003-Reverted-connectErrorCode-removal.patch --- freerdp2-2.3.0+dfsg1/debian/patches/0003-Reverted-connectErrorCode-removal.patch 1970-01-01 00:00:00.000000000 +0000 +++ freerdp2-2.3.0+dfsg1/debian/patches/0003-Reverted-connectErrorCode-removal.patch 2021-04-29 09:55:48.000000000 +0000 @@ -0,0 +1,149 @@ +From 73753f8af40de20703858fff37a762b7f5580bb0 Mon Sep 17 00:00:00 2001 +From: akallabeth +Date: Sat, 27 Feb 2021 08:35:33 +0100 +Subject: [PATCH 03/36] Reverted connectErrorCode removal + +Reverted changes from e4b30a5cb6100a8ea4f320b829c9c5712ed4a783 +removing the symbol/define, keep the changes for the clients. +Mark as deprecated +--- + include/freerdp/error.h | 25 +++++++++++++++++ + libfreerdp/core/errinfo.c | 2 ++ + libfreerdp/core/freerdp.c | 58 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 85 insertions(+) + +diff --git a/include/freerdp/error.h b/include/freerdp/error.h +index 0fb51608b..a928a645a 100644 +--- a/include/freerdp/error.h ++++ b/include/freerdp/error.h +@@ -177,6 +177,31 @@ extern "C" + FREERDP_API const char* freerdp_get_error_info_name(UINT32 code); + FREERDP_API const char* freerdp_get_error_info_category(UINT32 code); + ++ /** ++ * DEPRECATED! ++ * This static variable holds an error code if the return value from connect is FALSE. ++ * This variable is always set to 0 in the beginning of the connect sequence. ++ * The returned code can be used to inform the user of the detailed connect error. ++ * The value can hold one of the defined error codes below OR an error according to errno ++ */ ++ ++ FREERDP_API extern int connectErrorCode; ++ ++#define ERRORSTART 10000 ++#define PREECONNECTERROR ERRORSTART + 1 ++#define UNDEFINEDCONNECTERROR ERRORSTART + 2 ++#define POSTCONNECTERROR ERRORSTART + 3 ++#define DNSERROR ERRORSTART + 4 /* general DNS ERROR */ ++#define DNSNAMENOTFOUND ERRORSTART + 5 /* EAI_NONAME */ ++#define CONNECTERROR \ ++ ERRORSTART + 6 /* a connect error if errno is not define during tcp connect \ ++ */ ++#define MCSCONNECTINITIALERROR ERRORSTART + 7 ++#define TLSCONNECTERROR ERRORSTART + 8 ++#define AUTHENTICATIONERROR ERRORSTART + 9 ++#define INSUFFICIENTPRIVILEGESERROR ERRORSTART + 10 ++#define CANCELEDBYUSER ERRORSTART + 11 ++ + /** + * FreeRDP Context Error Codes + */ +diff --git a/libfreerdp/core/errinfo.c b/libfreerdp/core/errinfo.c +index abfe96efd..e635847dc 100644 +--- a/libfreerdp/core/errinfo.c ++++ b/libfreerdp/core/errinfo.c +@@ -34,6 +34,8 @@ + ERRINFO_##_code, "ERRINFO_" #_code, ERRINFO_##_code##_STRING, category \ + } + ++int connectErrorCode; ++ + /* Protocol-independent codes */ + + #define ERRINFO_RPC_INITIATED_DISCONNECT_STRING \ +diff --git a/libfreerdp/core/freerdp.c b/libfreerdp/core/freerdp.c +index 81183e76d..9094bc346 100644 +--- a/libfreerdp/core/freerdp.c ++++ b/libfreerdp/core/freerdp.c +@@ -55,6 +55,8 @@ + + #define TAG FREERDP_TAG("core") + ++/* connectErrorCode is 'extern' in error.h. See comment there.*/ ++ + UINT freerdp_channel_add_init_handle_data(rdpChannelHandles* handles, void* pInitHandle, + void* pUserData) + { +@@ -161,6 +163,7 @@ BOOL freerdp_connect(freerdp* instance) + + /* We always set the return code to 0 before we start the connect sequence*/ + instance->ConnectionCallbackState = CLIENT_STATE_INITIAL; ++ connectErrorCode = 0; + freerdp_set_last_error_log(instance->context, FREERDP_ERROR_SUCCESS); + clearChannelError(instance->context); + ResetEvent(instance->context->abortEvent); +@@ -890,6 +893,61 @@ void freerdp_set_last_error_ex(rdpContext* context, UINT32 lastError, const char + } + + context->LastError = lastError; ++ ++ switch (lastError) ++ { ++ case FREERDP_ERROR_PRE_CONNECT_FAILED: ++ connectErrorCode = PREECONNECTERROR; ++ break; ++ ++ case FREERDP_ERROR_CONNECT_UNDEFINED: ++ connectErrorCode = UNDEFINEDCONNECTERROR; ++ break; ++ ++ case FREERDP_ERROR_POST_CONNECT_FAILED: ++ connectErrorCode = POSTCONNECTERROR; ++ break; ++ ++ case FREERDP_ERROR_DNS_ERROR: ++ connectErrorCode = DNSERROR; ++ break; ++ ++ case FREERDP_ERROR_DNS_NAME_NOT_FOUND: ++ connectErrorCode = DNSNAMENOTFOUND; ++ break; ++ ++ case FREERDP_ERROR_CONNECT_FAILED: ++ connectErrorCode = CONNECTERROR; ++ break; ++ ++ case FREERDP_ERROR_MCS_CONNECT_INITIAL_ERROR: ++ connectErrorCode = MCSCONNECTINITIALERROR; ++ break; ++ ++ case FREERDP_ERROR_TLS_CONNECT_FAILED: ++ connectErrorCode = TLSCONNECTERROR; ++ break; ++ ++ case FREERDP_ERROR_AUTHENTICATION_FAILED: ++ connectErrorCode = AUTHENTICATIONERROR; ++ break; ++ ++ case FREERDP_ERROR_INSUFFICIENT_PRIVILEGES: ++ connectErrorCode = INSUFFICIENTPRIVILEGESERROR; ++ break; ++ ++ case FREERDP_ERROR_CONNECT_CANCELLED: ++ connectErrorCode = CANCELEDBYUSER; ++ break; ++ ++ case FREERDP_ERROR_SECURITY_NEGO_CONNECT_FAILED: ++ connectErrorCode = CONNECTERROR; ++ break; ++ ++ case FREERDP_ERROR_CONNECT_TRANSPORT_FAILED: ++ connectErrorCode = CONNECTERROR; ++ break; ++ } + } + + const char* freerdp_get_logon_error_info_type(UINT32 type) +-- +2.30.2 + diff -Nru freerdp2-2.3.0+dfsg1/debian/patches/0004-Fixed-a-leak-on-mouse-cursor-updates.patch freerdp2-2.3.0+dfsg1/debian/patches/0004-Fixed-a-leak-on-mouse-cursor-updates.patch --- freerdp2-2.3.0+dfsg1/debian/patches/0004-Fixed-a-leak-on-mouse-cursor-updates.patch 1970-01-01 00:00:00.000000000 +0000 +++ freerdp2-2.3.0+dfsg1/debian/patches/0004-Fixed-a-leak-on-mouse-cursor-updates.patch 2021-04-29 09:55:48.000000000 +0000 @@ -0,0 +1,37 @@ +From d88480fc48d9599a8d46e255e13ed9dbb89defde Mon Sep 17 00:00:00 2001 +From: akallabeth +Date: Sat, 27 Feb 2021 17:37:35 +0100 +Subject: [PATCH 04/36] Fixed a leak on mouse cursor updates + +--- + client/X11/xf_graphics.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/client/X11/xf_graphics.c b/client/X11/xf_graphics.c +index 20d54f50c..54a4b9cc7 100644 +--- a/client/X11/xf_graphics.c ++++ b/client/X11/xf_graphics.c +@@ -305,14 +305,14 @@ static BOOL _xf_Pointer_GetCursorForCurrentScale(rdpContext* context, const rdpP + ci.yhot = pointer->yPos * yscale; + size = ci.height * ci.width * GetBytesPerPixel(CursorFormat); + +- if (!(ci.pixels = (XcursorPixel*)_aligned_malloc(size, 16))) +- { +- xf_unlock_x11(xfc); +- return FALSE; +- } +- + if (xscale != 1 || yscale != 1) + { ++ if (!(ci.pixels = (XcursorPixel*)_aligned_malloc(size, 16))) ++ { ++ xf_unlock_x11(xfc); ++ return FALSE; ++ } ++ + if (!freerdp_image_scale((BYTE*)ci.pixels, CursorFormat, 0, 0, 0, ci.width, ci.height, + (BYTE*)xpointer->cursorPixels, CursorFormat, 0, 0, 0, + pointer->width, pointer->height)) +-- +2.30.2 + diff -Nru freerdp2-2.3.0+dfsg1/debian/patches/0007-Fixed-format-string-in-smartcard_trace_state_return.patch freerdp2-2.3.0+dfsg1/debian/patches/0007-Fixed-format-string-in-smartcard_trace_state_return.patch --- freerdp2-2.3.0+dfsg1/debian/patches/0007-Fixed-format-string-in-smartcard_trace_state_return.patch 1970-01-01 00:00:00.000000000 +0000 +++ freerdp2-2.3.0+dfsg1/debian/patches/0007-Fixed-format-string-in-smartcard_trace_state_return.patch 2021-04-29 09:55:48.000000000 +0000 @@ -0,0 +1,46 @@ +From 69ff618ebc142b53062115fab1547eb5ff2c25d7 Mon Sep 17 00:00:00 2001 +From: akallabeth +Date: Tue, 2 Mar 2021 07:50:17 +0100 +Subject: [PATCH 07/36] Fixed format string in smartcard_trace_state_return + +(cherry picked from commit ca96c4450707d39dbd5c94f2b1c4ae807789b012) +--- + channels/smartcard/client/smartcard_pack.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/channels/smartcard/client/smartcard_pack.c b/channels/smartcard/client/smartcard_pack.c +index f5987d4b5..ed0301bb2 100644 +--- a/channels/smartcard/client/smartcard_pack.c ++++ b/channels/smartcard/client/smartcard_pack.c +@@ -1307,21 +1307,24 @@ static void smartcard_trace_status_return(SMARTCARD_DEVICE* smartcard, const Sta + static void smartcard_trace_state_return(SMARTCARD_DEVICE* smartcard, const State_Return* ret) + { + char buffer[1024]; +- ++ char* state; + WINPR_UNUSED(smartcard); + + if (!WLog_IsLevelActive(WLog_Get(TAG), g_LogLevel)) + return; + ++ state = SCardGetReaderStateString(ret->dwState); + WLog_LVL(TAG, g_LogLevel, "Reconnect_Return {"); + WLog_LVL(TAG, g_LogLevel, " ReturnCode: %s (0x%08" PRIX32 ")", + SCardGetErrorString(ret->ReturnCode), ret->ReturnCode); +- WLog_LVL(TAG, g_LogLevel, " dwState: %s (0x%08" PRIX32 ")", ret->dwState); +- WLog_LVL(TAG, g_LogLevel, " dwProtocol: %s (0x%08" PRIX32 ")", ret->dwProtocol); +- WLog_LVL(TAG, g_LogLevel, " cbAtrLen: %s (0x%08" PRIX32 ")", ret->cbAtrLen); ++ WLog_LVL(TAG, g_LogLevel, " dwState: %s (0x%08" PRIX32 ")", state, ret->dwState); ++ WLog_LVL(TAG, g_LogLevel, " dwProtocol: %s (0x%08" PRIX32 ")", ++ SCardGetProtocolString(ret->dwProtocol), ret->dwProtocol); ++ WLog_LVL(TAG, g_LogLevel, " cbAtrLen: (0x%08" PRIX32 ")", ret->cbAtrLen); + WLog_LVL(TAG, g_LogLevel, " rgAtr: %s", + smartcard_array_dump(ret->rgAtr, sizeof(ret->rgAtr), buffer, sizeof(buffer))); + WLog_LVL(TAG, g_LogLevel, "}"); ++ free(state); + } + + static void smartcard_trace_reconnect_return(SMARTCARD_DEVICE* smartcard, +-- +2.30.2 + diff -Nru freerdp2-2.3.0+dfsg1/debian/patches/0008-Fixed-linking-dependencies-for-client-geometry-chann.patch freerdp2-2.3.0+dfsg1/debian/patches/0008-Fixed-linking-dependencies-for-client-geometry-chann.patch --- freerdp2-2.3.0+dfsg1/debian/patches/0008-Fixed-linking-dependencies-for-client-geometry-chann.patch 1970-01-01 00:00:00.000000000 +0000 +++ freerdp2-2.3.0+dfsg1/debian/patches/0008-Fixed-linking-dependencies-for-client-geometry-chann.patch 2021-04-29 09:55:48.000000000 +0000 @@ -0,0 +1,30 @@ +From de743a836a982807cbb88efdebb66c09eea010f2 Mon Sep 17 00:00:00 2001 +From: akallabeth +Date: Tue, 1 Dec 2020 11:44:14 +0100 +Subject: [PATCH 08/36] Fixed linking dependencies for client geometry channel + +(cherry picked from commit 7056433c8ecd045912fecb896ffa2eac3aad1410) +--- + channels/geometry/client/CMakeLists.txt | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/channels/geometry/client/CMakeLists.txt b/channels/geometry/client/CMakeLists.txt +index ea28bff9d..ac9fdc407 100644 +--- a/channels/geometry/client/CMakeLists.txt ++++ b/channels/geometry/client/CMakeLists.txt +@@ -25,9 +25,10 @@ include_directories(..) + + add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry") + +- +- + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr) ++if (NOT BUILTIN_CHANNELS OR NOT BUILD_SHARED_LIBS) ++ set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client) ++endif() + + target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) + +-- +2.30.2 + diff -Nru freerdp2-2.3.0+dfsg1/debian/patches/0010-Fixed-smartcard_convert_string_list-with-0-length.patch freerdp2-2.3.0+dfsg1/debian/patches/0010-Fixed-smartcard_convert_string_list-with-0-length.patch --- freerdp2-2.3.0+dfsg1/debian/patches/0010-Fixed-smartcard_convert_string_list-with-0-length.patch 1970-01-01 00:00:00.000000000 +0000 +++ freerdp2-2.3.0+dfsg1/debian/patches/0010-Fixed-smartcard_convert_string_list-with-0-length.patch 2021-04-29 09:55:48.000000000 +0000 @@ -0,0 +1,45 @@ +From 471cda7ef304afb27c2fd1aa5a59078c7401e46e Mon Sep 17 00:00:00 2001 +From: Armin Novak +Date: Wed, 3 Mar 2021 11:39:55 +0100 +Subject: [PATCH 10/36] Fixed smartcard_convert_string_list with 0 length + +(cherry picked from commit e9904e286f43dea5940182b25740730c55e7c8a6) +--- + channels/smartcard/client/smartcard_pack.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/channels/smartcard/client/smartcard_pack.c b/channels/smartcard/client/smartcard_pack.c +index ed0301bb2..83c9d3023 100644 +--- a/channels/smartcard/client/smartcard_pack.c ++++ b/channels/smartcard/client/smartcard_pack.c +@@ -351,8 +351,11 @@ static char* smartcard_convert_string_list(const void* in, size_t bytes, BOOL un + + if (unicode) + { +- length = (bytes / 2); +- if (ConvertFromUnicode(CP_UTF8, 0, string.wz, (int)length, &mszA, 0, NULL, NULL) != ++ length = (bytes / sizeof(WCHAR)) - 1; ++ mszA = (char*)calloc(length + 1, sizeof(WCHAR)); ++ if (!mszA) ++ return NULL; ++ if (ConvertFromUnicode(CP_UTF8, 0, string.wz, (int)length, &mszA, length + 1, NULL, NULL) != + (int)length) + { + free(mszA); +@@ -362,10 +365,11 @@ static char* smartcard_convert_string_list(const void* in, size_t bytes, BOOL un + else + { + length = bytes; +- mszA = (char*)malloc(length); ++ mszA = (char*)calloc(length, sizeof(char)); + if (!mszA) + return NULL; +- CopyMemory(mszA, string.sz, length); ++ CopyMemory(mszA, string.sz, length - 1); ++ mszA[length - 1] = '\0'; + } + + for (index = 0; index < length - 1; index++) +-- +2.30.2 + diff -Nru freerdp2-2.3.0+dfsg1/debian/patches/0012-Parse-on-a-copy-of-the-argument-string-for-printer.patch freerdp2-2.3.0+dfsg1/debian/patches/0012-Parse-on-a-copy-of-the-argument-string-for-printer.patch --- freerdp2-2.3.0+dfsg1/debian/patches/0012-Parse-on-a-copy-of-the-argument-string-for-printer.patch 1970-01-01 00:00:00.000000000 +0000 +++ freerdp2-2.3.0+dfsg1/debian/patches/0012-Parse-on-a-copy-of-the-argument-string-for-printer.patch 2021-04-29 09:55:48.000000000 +0000 @@ -0,0 +1,49 @@ +From 9ce4bc351f188ee52786c6f3a6b4ee1b48926bfd Mon Sep 17 00:00:00 2001 +From: akallabeth +Date: Thu, 4 Mar 2021 14:26:35 +0100 +Subject: [PATCH 12/36] Parse on a copy of the argument string for printer + +If done on original the wrong backend is loaded on autoreconnect + +(cherry picked from commit af1c6ebcb49c93d636817ec98f74d07cba9d7f26) +--- + channels/printer/client/printer_main.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/channels/printer/client/printer_main.c b/channels/printer/client/printer_main.c +index dbcc07dc5..170ecb15b 100644 +--- a/channels/printer/client/printer_main.c ++++ b/channels/printer/client/printer_main.c +@@ -979,7 +979,7 @@ printer_DeviceServiceEntry + + device = (RDPDR_PRINTER*)pEntryPoints->device; + name = device->Name; +- driver_name = device->DriverName; ++ driver_name = _strdup(device->DriverName); + + /* Secondary argument is one of the following: + * +@@ -1016,7 +1016,8 @@ printer_DeviceServiceEntry + if (!driver) + { + WLog_ERR(TAG, "Could not get a printer driver!"); +- return CHANNEL_RC_INITIALIZATION_ERROR; ++ error = CHANNEL_RC_INITIALIZATION_ERROR; ++ goto fail; + } + + if (name && name[0]) +@@ -1064,7 +1065,9 @@ printer_DeviceServiceEntry + } + + fail: +- driver->ReleaseRef(driver); ++ free(driver_name); ++ if (driver) ++ driver->ReleaseRef(driver); + + return error; + } +-- +2.30.2 + diff -Nru freerdp2-2.3.0+dfsg1/debian/patches/0015-Fix-xf_Pointer_SetPosition-with-smart-sizing.patch freerdp2-2.3.0+dfsg1/debian/patches/0015-Fix-xf_Pointer_SetPosition-with-smart-sizing.patch --- freerdp2-2.3.0+dfsg1/debian/patches/0015-Fix-xf_Pointer_SetPosition-with-smart-sizing.patch 1970-01-01 00:00:00.000000000 +0000 +++ freerdp2-2.3.0+dfsg1/debian/patches/0015-Fix-xf_Pointer_SetPosition-with-smart-sizing.patch 2021-04-29 09:55:48.000000000 +0000 @@ -0,0 +1,99 @@ +From 899be1b564ac4f4803de5b81e0711821403d9ed1 Mon Sep 17 00:00:00 2001 +From: akallabeth +Date: Mon, 8 Mar 2021 13:52:29 +0100 +Subject: [PATCH 15/36] Fix xf_Pointer_SetPosition with smart-sizing + +(cherry picked from commit d3e3ab7b5d5ce376ba72fa1fc0aee2f25c9682b4) +--- + client/X11/xf_event.c | 31 +++++++++++++++++++++++++++++++ + client/X11/xf_event.h | 1 + + client/X11/xf_graphics.c | 5 ++++- + 3 files changed, 36 insertions(+), 1 deletion(-) + +diff --git a/client/X11/xf_event.c b/client/X11/xf_event.c +index 60fe9c6b3..99577b1a1 100644 +--- a/client/X11/xf_event.c ++++ b/client/X11/xf_event.c +@@ -262,6 +262,37 @@ static BOOL xf_event_execute_action_script(xfContext* xfc, const XEvent* event) + return TRUE; + } + ++void xf_adjust_coordinates_to_screen(xfContext* xfc, UINT32* x, UINT32* y) ++{ ++ rdpSettings* settings; ++ INT64 tx, ty; ++ ++ if (!xfc || !xfc->context.settings || !y || !x) ++ return; ++ ++ settings = xfc->context.settings; ++ tx = *x; ++ ty = *y; ++ if (!xfc->remote_app) ++ { ++#ifdef WITH_XRENDER ++ ++ if (xf_picture_transform_required(xfc)) ++ { ++ double xScalingFactor = xfc->scaledWidth / (double)settings->DesktopWidth; ++ double yScalingFactor = xfc->scaledHeight / (double)settings->DesktopHeight; ++ tx = ((tx + xfc->offset_x) * xScalingFactor); ++ ty = ((ty + xfc->offset_y) * yScalingFactor); ++ } ++ ++#endif ++ } ++ ++ CLAMP_COORDINATES(tx, ty); ++ *x = tx; ++ *y = ty; ++} ++ + void xf_event_adjust_coordinates(xfContext* xfc, int* x, int* y) + { + rdpSettings* settings; +diff --git a/client/X11/xf_event.h b/client/X11/xf_event.h +index 185c83c7c..2269d3eea 100644 +--- a/client/X11/xf_event.h ++++ b/client/X11/xf_event.h +@@ -33,6 +33,7 @@ void xf_event_SendClientEvent(xfContext* xfc, xfWindow* window, Atom atom, unsig + ...); + + void xf_event_adjust_coordinates(xfContext* xfc, int* x, int* y); ++void xf_adjust_coordinates_to_screen(xfContext* xfc, UINT32* x, UINT32* y); + + BOOL xf_generic_MotionNotify(xfContext* xfc, int x, int y, int state, Window window, BOOL app); + BOOL xf_generic_ButtonPress(xfContext* xfc, int x, int y, int button, Window window, BOOL app); +diff --git a/client/X11/xf_graphics.c b/client/X11/xf_graphics.c +index 54a4b9cc7..1700092f8 100644 +--- a/client/X11/xf_graphics.c ++++ b/client/X11/xf_graphics.c +@@ -37,6 +37,7 @@ + + #include "xf_graphics.h" + #include "xf_gdi.h" ++#include "xf_event.h" + + #include + #define TAG CLIENT_TAG("x11") +@@ -521,6 +522,8 @@ static BOOL xf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y) + if (xfc->remote_app && !xfc->focused) + return TRUE; + ++ xf_adjust_coordinates_to_screen(xfc, &x, &y); ++ + xf_lock_x11(xfc); + + rc = XGetWindowAttributes(xfc->display, handle, ¤t); +@@ -541,7 +544,7 @@ static BOOL xf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y) + + rc = XWarpPointer(xfc->display, None, handle, 0, 0, 0, 0, x, y); + if (rc == 0) +- WLog_WARN(TAG, "xf_Pointer_SetPosition: XWrapPointer==%d", rc); ++ WLog_WARN(TAG, "xf_Pointer_SetPosition: XWarpPointer==%d", rc); + tmp.event_mask = current.your_event_mask; + rc = XChangeWindowAttributes(xfc->display, handle, CWEventMask, &tmp); + if (rc == 0) +-- +2.30.2 + diff -Nru freerdp2-2.3.0+dfsg1/debian/patches/0017-Backported-6865-Disable-websockets-command-line-opti.patch freerdp2-2.3.0+dfsg1/debian/patches/0017-Backported-6865-Disable-websockets-command-line-opti.patch --- freerdp2-2.3.0+dfsg1/debian/patches/0017-Backported-6865-Disable-websockets-command-line-opti.patch 1970-01-01 00:00:00.000000000 +0000 +++ freerdp2-2.3.0+dfsg1/debian/patches/0017-Backported-6865-Disable-websockets-command-line-opti.patch 2021-04-29 10:04:00.000000000 +0000 @@ -0,0 +1,145 @@ +From f4c87729e393c4f9f522d2731078655f469d9b12 Mon Sep 17 00:00:00 2001 +From: akallabeth +Date: Mon, 8 Mar 2021 14:31:17 +0100 +Subject: [PATCH 17/36] Backported #6865: Disable websockets command line + option + +--- + client/common/cmdline.c | 30 ++++++++++++++----- + client/common/cmdline.h | 4 +-- + include/freerdp/settings.h | 4 ++- + libfreerdp/common/settings_getters.c | 7 +++++ + libfreerdp/common/settings_str.c | 1 + + libfreerdp/core/gateway/rdg.c | 4 ++- + .../core/test/settings_property_lists.h | 1 + + 7 files changed, 39 insertions(+), 12 deletions(-) + +--- a/client/common/cmdline.c ++++ b/client/common/cmdline.c +@@ -2234,15 +2234,29 @@ + settings->GatewayRpcTransport = TRUE; + settings->GatewayHttpTransport = FALSE; + } +- else if (_stricmp(arg->Value, "http") == 0) ++ else + { +- settings->GatewayRpcTransport = FALSE; +- settings->GatewayHttpTransport = TRUE; +- } +- else if (_stricmp(arg->Value, "auto") == 0) +- { +- settings->GatewayRpcTransport = TRUE; +- settings->GatewayHttpTransport = TRUE; ++ char* c = strchr(arg->Value, ','); ++ if (c) ++ { ++ *c++ = '\0'; ++ if (_stricmp(c, "no-websockets") != 0) ++ { ++ return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; ++ } ++ freerdp_settings_set_bool(settings, FreeRDP_GatewayHttpUseWebsockets, FALSE); ++ } ++ ++ if (_stricmp(arg->Value, "http") == 0) ++ { ++ settings->GatewayRpcTransport = FALSE; ++ settings->GatewayHttpTransport = TRUE; ++ } ++ else if (_stricmp(arg->Value, "auto") == 0) ++ { ++ settings->GatewayRpcTransport = TRUE; ++ settings->GatewayHttpTransport = TRUE; ++ } + } + } + CommandLineSwitchCase(arg, "gat") +--- a/client/common/cmdline.h ++++ b/client/common/cmdline.h +@@ -180,8 +180,8 @@ + { "gp", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Gateway password" }, + { "grab-keyboard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, + "Grab keyboard" }, +- { "gt", COMMAND_LINE_VALUE_REQUIRED, "[rpc|http|auto]", NULL, NULL, -1, NULL, +- "Gateway transport type" }, ++ { "gt", COMMAND_LINE_VALUE_REQUIRED, "[rpc|http[,no-websockets]|auto[,no-websockets]]", NULL, ++ NULL, -1, NULL, "Gateway transport type" }, + { "gu", COMMAND_LINE_VALUE_REQUIRED, "[[\\]|[@]]", NULL, NULL, -1, + NULL, "Gateway username" }, + { "gat", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, +--- a/include/freerdp/settings.h ++++ b/include/freerdp/settings.h +@@ -751,6 +751,7 @@ + #define FreeRDP_GatewayAccessToken (1997) + #define FreeRDP_GatewayAcceptedCert (1998) + #define FreeRDP_GatewayAcceptedCertLength (1999) ++#define FreeRDP_GatewayHttpUseWebsockets (2000) + #define FreeRDP_ProxyType (2015) + #define FreeRDP_ProxyHostname (2016) + #define FreeRDP_ProxyPort (2017) +@@ -1252,7 +1253,8 @@ + ALIGN64 char* GatewayAccessToken; /* 1997 */ + ALIGN64 char* GatewayAcceptedCert; /* 1998 */ + ALIGN64 UINT32 GatewayAcceptedCertLength; /* 1999 */ +- UINT64 padding2015[2015 - 2000]; /* 2000 */ ++ ALIGN64 BOOL GatewayHttpUseWebsockets; /* 2000 */ ++ UINT64 padding2015[2015 - 2001]; /* 2001 */ + + /* Proxy */ + ALIGN64 UINT32 ProxyType; /* 2015 */ +--- a/libfreerdp/common/settings_getters.c ++++ b/libfreerdp/common/settings_getters.c +@@ -192,6 +192,9 @@ + case FreeRDP_GatewayHttpTransport: + return settings->GatewayHttpTransport; + ++ case FreeRDP_GatewayHttpUseWebsockets: ++ return settings->GatewayHttpUseWebsockets; ++ + case FreeRDP_GatewayRpcTransport: + return settings->GatewayRpcTransport; + +@@ -754,6 +757,10 @@ + settings->GatewayHttpTransport = val; + break; + ++ case FreeRDP_GatewayHttpUseWebsockets: ++ settings->GatewayHttpUseWebsockets = val; ++ break; ++ + case FreeRDP_GatewayRpcTransport: + settings->GatewayRpcTransport = val; + break; +--- a/libfreerdp/common/settings_str.c ++++ b/libfreerdp/common/settings_str.c +@@ -74,6 +74,7 @@ + { FreeRDP_GatewayBypassLocal, 0, "FreeRDP_GatewayBypassLocal" }, + { FreeRDP_GatewayEnabled, 0, "FreeRDP_GatewayEnabled" }, + { FreeRDP_GatewayHttpTransport, 0, "FreeRDP_GatewayHttpTransport" }, ++ { FreeRDP_GatewayHttpUseWebsockets, 0, "FreeRDP_GatewayHttpUseWebsockets" }, + { FreeRDP_GatewayRpcTransport, 0, "FreeRDP_GatewayRpcTransport" }, + { FreeRDP_GatewayUdpTransport, 0, "FreeRDP_GatewayUdpTransport" }, + { FreeRDP_GatewayUseSameCredentials, 0, "FreeRDP_GatewayUseSameCredentials" }, +--- a/libfreerdp/core/gateway/rdg.c ++++ b/libfreerdp/core/gateway/rdg.c +@@ -2547,7 +2547,9 @@ + !http_context_set_user_agent(rdg->http, "MS-RDGateway/1.0") || + !http_context_set_host(rdg->http, rdg->settings->GatewayHostname) || + !http_context_set_rdg_connection_id(rdg->http, bracedUuid) || +- !http_context_enable_websocket_upgrade(rdg->http, TRUE)) ++ !http_context_enable_websocket_upgrade( ++ rdg->http, ++ freerdp_settings_get_bool(rdg->settings, FreeRDP_GatewayHttpUseWebsockets))) + { + goto rdg_alloc_error; + } +--- a/libfreerdp/core/test/settings_property_lists.h ++++ b/libfreerdp/core/test/settings_property_lists.h +@@ -63,6 +63,7 @@ + FreeRDP_GatewayBypassLocal, + FreeRDP_GatewayEnabled, + FreeRDP_GatewayHttpTransport, ++ FreeRDP_GatewayHttpUseWebsockets, + FreeRDP_GatewayRpcTransport, + FreeRDP_GatewayUdpTransport, + FreeRDP_GatewayUseSameCredentials, diff -Nru freerdp2-2.3.0+dfsg1/debian/patches/0019-Check-smartcard_convert_string_list-for-NULL-string.patch freerdp2-2.3.0+dfsg1/debian/patches/0019-Check-smartcard_convert_string_list-for-NULL-string.patch --- freerdp2-2.3.0+dfsg1/debian/patches/0019-Check-smartcard_convert_string_list-for-NULL-string.patch 1970-01-01 00:00:00.000000000 +0000 +++ freerdp2-2.3.0+dfsg1/debian/patches/0019-Check-smartcard_convert_string_list-for-NULL-string.patch 2021-04-29 09:55:48.000000000 +0000 @@ -0,0 +1,31 @@ +From 42f9dff46f736eb3f58d4bb1731710bda00608f9 Mon Sep 17 00:00:00 2001 +From: akallabeth +Date: Tue, 9 Mar 2021 09:22:39 +0100 +Subject: [PATCH 19/36] Check smartcard_convert_string_list for NULL string + +In #6821 it has been reported that there are buggy smartcard +drivers that report a string size but fail to allocate the string +itself. This check avoids a crash with such input parameters + +(cherry picked from commit f8b1e662b33f7b8f77cf6582d549348c2d048a2e) +--- + channels/smartcard/client/smartcard_pack.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/channels/smartcard/client/smartcard_pack.c b/channels/smartcard/client/smartcard_pack.c +index 83c9d3023..f70eb4e5d 100644 +--- a/channels/smartcard/client/smartcard_pack.c ++++ b/channels/smartcard/client/smartcard_pack.c +@@ -349,6 +349,9 @@ static char* smartcard_convert_string_list(const void* in, size_t bytes, BOOL un + if (bytes < 1) + return NULL; + ++ if (in == NULL) ++ return NULL; ++ + if (unicode) + { + length = (bytes / sizeof(WCHAR)) - 1; +-- +2.30.2 + diff -Nru freerdp2-2.3.0+dfsg1/debian/patches/0020-Use-specific-names-for-drive-hotplug-special-values.patch freerdp2-2.3.0+dfsg1/debian/patches/0020-Use-specific-names-for-drive-hotplug-special-values.patch --- freerdp2-2.3.0+dfsg1/debian/patches/0020-Use-specific-names-for-drive-hotplug-special-values.patch 1970-01-01 00:00:00.000000000 +0000 +++ freerdp2-2.3.0+dfsg1/debian/patches/0020-Use-specific-names-for-drive-hotplug-special-values.patch 2021-04-29 10:04:04.000000000 +0000 @@ -0,0 +1,57 @@ +From 187cbdfe2c0abdef554306394d12a9b28a5100eb Mon Sep 17 00:00:00 2001 +From: akallabeth +Date: Tue, 9 Mar 2021 12:09:58 +0100 +Subject: [PATCH 20/36] Use specific names for drive hotplug special values + +(cherry picked from commit b1be3d78fcc63a5842f7707a139b2582a4a42b21) +--- + client/common/cmdline.c | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + +--- a/client/common/cmdline.c ++++ b/client/common/cmdline.c +@@ -120,6 +120,23 @@ + return TRUE; + } + ++static char* name_from_path(const char* path) ++{ ++ const char* name = "NULL"; ++ if (path) ++ { ++ if (_strnicmp(path, "%", 2) == 0) ++ name = "home"; ++ else if (_strnicmp(path, "*", 2) == 0) ++ name = "hotplug-all"; ++ else if (_strnicmp(path, "DynamicDrives", 2) == 0) ++ name = "hotplug"; ++ else ++ name = path; ++ } ++ return _strdup(name); ++} ++ + static BOOL freerdp_client_add_drive(rdpSettings* settings, const char* path, const char* name) + { + RDPDR_DRIVE* drive; +@@ -151,8 +168,10 @@ + goto fail; + } + else /* We need a name to send to the server. */ +- if (!(drive->Name = _strdup(path))) +- goto fail; ++ { ++ if (!(drive->Name = name_from_path(path))) ++ goto fail; ++ } + + if (!path || !freerdp_sanitize_drive_name(drive->Name, "\\/", "__")) + goto fail; +@@ -3557,6 +3576,7 @@ + /* Syntax: Comma seperated list of the following entries: + * '*' ... Redirect all drives, including hotplug + * 'DynamicDrives' ... hotplug ++ * '%' ... user home directory + *