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
This commit is contained in:
Mike Gabriel 2021-04-29 12:05:36 +02:00
parent a58a05cff9
commit fc8bd9add6
2 changed files with 21 additions and 167 deletions

View File

@ -1,166 +0,0 @@
Description: This is a revert of upstream commit e4b30a5cb6100a8ea4f320b829c9c5712ed4a783 (breaking ABI compatibility with FreeRDP 2.2.0)
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
#diff --git a/client/Mac/cli/AppDelegate.m b/client/Mac/cli/AppDelegate.m
#index b7abcde70..698695676 100644
#--- a/client/Mac/cli/AppDelegate.m
#+++ b/client/Mac/cli/AppDelegate.m
#@@ -199,7 +199,6 @@ void mac_set_view_size(rdpContext *context, MRDPView *view);
#
# void AppDelegate_ConnectionResultEventHandler(void *ctx, ConnectionResultEventArgs *e)
# {
#- rdpContext *context = (rdpContext *)ctx;
# NSLog(@"ConnectionResult event result:%d\n", e->result);
#
# if (_singleDelegate)
#@@ -207,15 +206,11 @@ void AppDelegate_ConnectionResultEventHandler(void *ctx, ConnectionResultEventAr
# if (e->result != 0)
# {
# NSString *message = nil;
#- DWORD code = freerdp_get_last_error(context);
#- switch (code)
#+
#+ if (connectErrorCode == AUTHENTICATIONERROR)
# {
#- case FREERDP_ERROR_AUTHENTICATION_FAILED:
#- message = [NSString
#- stringWithFormat:@"%@", @"Authentication failure, check credentials."];
#- break;
#- default:
#- break;
#+ message = [NSString
#+ stringWithFormat:@"%@", @"Authentication failure, check credentials."];
# }
#
# // Making sure this should be invoked on the main UI thread.
diff --git a/include/freerdp/error.h b/include/freerdp/error.h
index 0fb51608b..f9d4b6ab0 100644
--- a/include/freerdp/error.h
+++ b/include/freerdp/error.h
@@ -177,6 +177,30 @@ extern "C"
FREERDP_API const char* freerdp_get_error_info_name(UINT32 code);
FREERDP_API const char* freerdp_get_error_info_category(UINT32 code);
+ /**
+ * 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)

22
debian/patches/series vendored
View File

@ -1,2 +1,22 @@
2001-fake-git-revision.patch
2002_revert-e4b30a5cb6100a8ea4f320b829c9c5712ed4a783.patch
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