Added patch to set LastError to 0 in GetSidIdentifierAuthority.

This commit is contained in:
Sebastian Lackner 2015-12-05 04:06:58 +01:00
parent 78db8b7950
commit 07a42a496d
5 changed files with 112 additions and 1 deletions

View File

@ -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]:**

View File

@ -0,0 +1,92 @@
From 86fe5438cdd5e3fbd3fd29c1240b6908ad70f2bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
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 <michael@fds-team.de>
---
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

View File

@ -0,0 +1 @@
Fixes: Set LastError to 0 in GetSidIdentifierAuthority

View File

@ -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:

View File

@ -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 <sebastian@fds-team.de> Tue, 01 Dec 2015 02:35:10 +0100
wine-staging (1.8~rc2) unstable; urgency=low