From 6b9bd93fe69dd17e62ae28287c26b7ef6df01041 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 7 Dec 2019 13:09:39 +0100 Subject: [PATCH] [WLDAP32] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/wldap32/error.c | 2 +- dll/win32/wldap32/init.c | 9 +++++---- dll/win32/wldap32/parse.c | 2 +- dll/win32/wldap32/winldap_private.h | 18 ++++++++++-------- media/doc/README.WINE | 2 +- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/dll/win32/wldap32/error.c b/dll/win32/wldap32/error.c index 2e09e9e3990..fbbd124d230 100644 --- a/dll/win32/wldap32/error.c +++ b/dll/win32/wldap32/error.c @@ -303,7 +303,7 @@ ULONG CDECL LdapMapErrorToWin32( ULONG err ) { TRACE( "(0x%08x)\n", err ); - if (err >= sizeof(WLDAP32_errormap)/sizeof(WLDAP32_errormap[0])) + if (err >= ARRAY_SIZE( WLDAP32_errormap )) return ERROR_DS_GENERIC_ERROR; return WLDAP32_errormap[err]; } diff --git a/dll/win32/wldap32/init.c b/dll/win32/wldap32/init.c index fdb79084b50..5b600a2df78 100644 --- a/dll/win32/wldap32/init.c +++ b/dll/win32/wldap32/init.c @@ -30,6 +30,7 @@ #include "windef.h" #include "winbase.h" #include "winnls.h" +#include "wine/winternl.h" #include "winldap_private.h" #include "wldap32.h" @@ -114,10 +115,10 @@ oom: /* Determine if a URL starts with a known LDAP scheme */ static BOOL has_ldap_scheme( char *url ) { - return !strncasecmp( url, "ldap://", 7 ) || - !strncasecmp( url, "ldaps://", 8 ) || - !strncasecmp( url, "ldapi://", 8 ) || - !strncasecmp( url, "cldap://", 8 ); + return !_strnicmp( url, "ldap://", 7 ) || + !_strnicmp( url, "ldaps://", 8 ) || + !_strnicmp( url, "ldapi://", 8 ) || + !_strnicmp( url, "cldap://", 8 ); } /* Flatten an array of hostnames into a space separated string of URLs. diff --git a/dll/win32/wldap32/parse.c b/dll/win32/wldap32/parse.c index 62ffdbab0da..e83e6d23517 100644 --- a/dll/win32/wldap32/parse.c +++ b/dll/win32/wldap32/parse.c @@ -258,7 +258,7 @@ ULONG CDECL ldap_parse_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result, ldap_memfree( matchedU ); ldap_memfree( errorU ); - strarrayfreeU( referralsU ); + ldap_memvfree( (void **)referralsU ); ldap_controls_free( serverctrlsU ); #endif diff --git a/dll/win32/wldap32/winldap_private.h b/dll/win32/wldap32/winldap_private.h index c0039eb0fdf..4d4d3581261 100644 --- a/dll/win32/wldap32/winldap_private.h +++ b/dll/win32/wldap32/winldap_private.h @@ -191,16 +191,18 @@ typedef struct WLDAP32_berval } LDAP_BERVAL, *PLDAP_BERVAL, BERVAL, *PBERVAL, WLDAP32_BerValue; #define LDAP_PAGED_RESULT_OID_STRING "1.2.840.113556.1.4.319" -#define LDAP_PAGED_RESULT_OID_STRING_W (const WCHAR []){'1','.','2','.', \ - '8','4','0','.','1','1','3','5','5','6','.','1','.','4','.','3','1','9',0} - #define LDAP_SERVER_RESP_SORT_OID "1.2.840.113556.1.4.474" -#define LDAP_SERVER_RESP_SORT_OID_W (const WCHAR []){'1','.','2','.', \ - '8','4','0','.','1','1','3','5','5','6','.','1','.','4','.','4','7','4',0} - #define LDAP_CONTROL_VLVRESPONSE "2.16.840.1.113730.3.4.10" -#define LDAP_CONTROL_VLVRESPONSE_W (const WCHAR []){'2','.','1','6','.', \ - '8','4','0','.','1','.','1','1','3','7','3','0','.','3','.','4','.','1','0',0} + +#if defined(_MSC_VER) || defined(__MINGW32__) +#define LDAP_PAGED_RESULT_OID_STRING_W L"1.2.840.113556.1.4.319" +#define LDAP_SERVER_RESP_SORT_OID_W L"1.2.840.113556.1.4.474" +#define LDAP_CONTROL_VLVRESPONSE_W L"2.16.840.1.113730.3.4.10" +#else +static const WCHAR LDAP_PAGED_RESULT_OID_STRING_W[] = {'1','.','2','.','8','4','0','.','1','1','3','5','5','6','.','1','.','4','.','3','1','9',0}; +static const WCHAR LDAP_SERVER_RESP_SORT_OID_W[] = {'1','.','2','.','8','4','0','.','1','1','3','5','5','6','.','1','.','4','.','4','7','4',0}; +static const WCHAR LDAP_CONTROL_VLVRESPONSE_W[] = {'2','.','1','6','.','8','4','0','.','1','.','1','1','3','7','3','0','.','3','.','4','.','1','0',0}; +#endif typedef struct ldapcontrolA { diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 54c585a517a..127fa7811ad 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -208,7 +208,7 @@ dll/win32/winmm/midimap # Forked at Wine-20050628 dll/win32/winmm/wavemap # Forked at Wine-20050628 dll/win32/winscard # Synced to WineStaging-4.18 dll/win32/wintrust # Synced to WineStaging-4.18 -dll/win32/wldap32 # Synced to WineStaging-3.3 +dll/win32/wldap32 # Synced to WineStaging-4.18 dll/win32/wmi # Synced to WineStaging-2.9 dll/win32/wmiutils # Synced to WineStaging-3.3 dll/win32/wmvcore # Synced to WineStaging-3.9