From 07a42a496de75a3fe32391688bcb9b47f47b6b89 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 5 Dec 2015 04:06:58 +0100 Subject: [PATCH] Added patch to set LastError to 0 in GetSidIdentifierAuthority. --- README.md | 3 +- ...tError-to-0-in-GetSidIdentifierAutho.patch | 92 +++++++++++++++++++ .../definition | 1 + patches/patchinstall.sh | 16 ++++ staging/changelog | 1 + 5 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 patches/advapi32-GetSidIdentifierAuthority/0001-advapi32-Set-LastError-to-0-in-GetSidIdentifierAutho.patch create mode 100644 patches/advapi32-GetSidIdentifierAuthority/definition diff --git a/README.md b/README.md index d19fa770..36d425ed 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,10 @@ Wine. All those differences are also documented on the Included bug fixes and improvements ----------------------------------- -**Bug fixes and features included in the next upcoming release [1]:** +**Bug fixes and features included in the next upcoming release [2]:** * Fix possible leak of explorer.exe processes and implement proper desktop refcounting +* Set LastError to 0 in GetSidIdentifierAuthority **Bug fixes and features in Wine Staging 1.8-rc2 [270]:** diff --git a/patches/advapi32-GetSidIdentifierAuthority/0001-advapi32-Set-LastError-to-0-in-GetSidIdentifierAutho.patch b/patches/advapi32-GetSidIdentifierAuthority/0001-advapi32-Set-LastError-to-0-in-GetSidIdentifierAutho.patch new file mode 100644 index 00000000..a5b22cfe --- /dev/null +++ b/patches/advapi32-GetSidIdentifierAuthority/0001-advapi32-Set-LastError-to-0-in-GetSidIdentifierAutho.patch @@ -0,0 +1,92 @@ +From 86fe5438cdd5e3fbd3fd29c1240b6908ad70f2bf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Fri, 4 Dec 2015 21:06:40 +0100 +Subject: advapi32: Set LastError to 0 in GetSidIdentifierAuthority. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Michael Müller +--- + dlls/advapi32/security.c | 3 ++- + dlls/advapi32/tests/security.c | 31 +++++++++++++++++++++++++++++++ + 2 files changed, 33 insertions(+), 1 deletion(-) + +diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c +index c64981e..08f88c0 100644 +--- a/dlls/advapi32/security.c ++++ b/dlls/advapi32/security.c +@@ -1167,7 +1167,8 @@ GetEffectiveRightsFromAclW( PACL pacl, PTRUSTEEW pTrustee, PACCESS_MASK pAccessR + PSID_IDENTIFIER_AUTHORITY WINAPI + GetSidIdentifierAuthority( PSID pSid ) + { +- return RtlIdentifierAuthoritySid(pSid); ++ SetLastError(ERROR_SUCCESS); ++ return RtlIdentifierAuthoritySid(pSid); + } + + /****************************************************************************** +diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c +index b171a81..f62601f 100644 +--- a/dlls/advapi32/tests/security.c ++++ b/dlls/advapi32/tests/security.c +@@ -132,6 +132,7 @@ static NTSTATUS (WINAPI *pRtlAnsiStringToUnicodeString)(PUNICODE_STRING,PCANSI_S + static BOOL (WINAPI *pGetWindowsAccountDomainSid)(PSID,PSID,DWORD*); + static void (WINAPI *pRtlInitAnsiString)(PANSI_STRING,PCSZ); + static NTSTATUS (WINAPI *pRtlFreeUnicodeString)(PUNICODE_STRING); ++static PSID_IDENTIFIER_AUTHORITY (WINAPI *pGetSidIdentifierAuthority)(PSID); + + static HMODULE hmod; + static int myARGC; +@@ -196,6 +197,7 @@ static void init(void) + pGetAclInformation = (void *)GetProcAddress(hmod, "GetAclInformation"); + pGetAce = (void *)GetProcAddress(hmod, "GetAce"); + pGetWindowsAccountDomainSid = (void *)GetProcAddress(hmod, "GetWindowsAccountDomainSid"); ++ pGetSidIdentifierAuthority = (void *)GetProcAddress(hmod, "GetSidIdentifierAuthority"); + + myARGC = winetest_get_mainargs( &myARGV ); + } +@@ -6040,6 +6042,34 @@ static void test_GetWindowsAccountDomainSid(void) + HeapFree(GetProcessHeap(), 0, user); + } + ++static void test_GetSidIdentifierAuthority(void) ++{ ++ char buffer[SECURITY_MAX_SID_SIZE]; ++ PSID authority_sid = (PSID *)&buffer; ++ PSID_IDENTIFIER_AUTHORITY id; ++ BOOL ret; ++ ++ if (!pGetSidIdentifierAuthority) ++ { ++ win_skip("GetSidIdentifierAuthority not available\n"); ++ return; ++ } ++ ++ memset(buffer, 0xcc, sizeof(buffer)); ++ ret = IsValidSid(authority_sid); ++ ok(!ret, "expected FALSE, got %u\n", ret); ++ ++ SetLastError(0xdeadbeef); ++ id = GetSidIdentifierAuthority(authority_sid); ++ ok(id != NULL, "got NULL pointer as identifier authority\n"); ++ ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", GetLastError()); ++ ++ SetLastError(0xdeadbeef); ++ id = GetSidIdentifierAuthority(NULL); ++ ok(id != NULL, "got NULL pointer as identifier authority\n"); ++ ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", GetLastError()); ++} ++ + START_TEST(security) + { + init(); +@@ -6084,4 +6114,5 @@ START_TEST(security) + test_AdjustTokenPrivileges(); + test_AddAce(); + test_system_security_access(); ++ test_GetSidIdentifierAuthority(); + } +-- +2.6.2 + diff --git a/patches/advapi32-GetSidIdentifierAuthority/definition b/patches/advapi32-GetSidIdentifierAuthority/definition new file mode 100644 index 00000000..e9b5fd16 --- /dev/null +++ b/patches/advapi32-GetSidIdentifierAuthority/definition @@ -0,0 +1 @@ +Fixes: Set LastError to 0 in GetSidIdentifierAuthority diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 1211e646..41e164b5 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -87,6 +87,7 @@ patch_enable_all () enable_Exagear="$1" enable_Pipelight="$1" enable_Staging="$1" + enable_advapi32_GetSidIdentifierAuthority="$1" enable_advapi32_LsaLookupSids="$1" enable_advapi32_RegCreateKeyTransacted="$1" enable_advapi32_SetSecurityInfo="$1" @@ -369,6 +370,9 @@ patch_enable () Staging) enable_Staging="$2" ;; + advapi32-GetSidIdentifierAuthority) + enable_advapi32_GetSidIdentifierAuthority="$2" + ;; advapi32-LsaLookupSids) enable_advapi32_LsaLookupSids="$2" ;; @@ -2220,6 +2224,18 @@ if test "$enable_Staging" -eq 1; then ) >> "$patchlist" fi +# Patchset advapi32-GetSidIdentifierAuthority +# | +# | Modified files: +# | * dlls/advapi32/security.c, dlls/advapi32/tests/security.c +# | +if test "$enable_advapi32_GetSidIdentifierAuthority" -eq 1; then + patch_apply advapi32-GetSidIdentifierAuthority/0001-advapi32-Set-LastError-to-0-in-GetSidIdentifierAutho.patch + ( + echo '+ { "Michael Müller", "advapi32: Set LastError to 0 in GetSidIdentifierAuthority.", 1 },'; + ) >> "$patchlist" +fi + # Patchset server-CreateProcess_ACLs # | # | This patchset fixes the following Wine bugs: diff --git a/staging/changelog b/staging/changelog index bb185d16..2b5b41b9 100644 --- a/staging/changelog +++ b/staging/changelog @@ -10,6 +10,7 @@ wine-staging (1.8~rc3) UNRELEASED; urgency=low (accepted upstream). * Added patch to fix possible leak of explorer.exe processes and implement proper desktop refcounting. + * Added patch to set LastError to 0 in GetSidIdentifierAuthority. -- Sebastian Lackner Tue, 01 Dec 2015 02:35:10 +0100 wine-staging (1.8~rc2) unstable; urgency=low