From 7de9f842e55bc00f48650e8ba7e262abf3ba701b Mon Sep 17 00:00:00 2001 From: Andrey Turkin Date: Sat, 10 Oct 2009 17:52:09 +0400 Subject: [PATCH] advapi32: Ignore invalid MultipleTrusteeOperation values in SetEntriesInAcl. --- dlls/advapi32/security.c | 2 +- dlls/advapi32/tests/security.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index bff68a36ccd..24c48c8b4c6 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -3484,7 +3484,7 @@ DWORD WINAPI SetEntriesInAclW( ULONG count, PEXPLICIT_ACCESSW pEntries, pEntries[i].Trustee.TrusteeForm, pEntries[i].Trustee.TrusteeType, pEntries[i].Trustee.ptstrName); - if (pEntries[i].Trustee.MultipleTrusteeOperation != NO_MULTIPLE_TRUSTEE) + if (pEntries[i].Trustee.MultipleTrusteeOperation == TRUSTEE_IS_IMPERSONATE) { WARN("bad multiple trustee operation %d for trustee %d\n", pEntries[i].Trustee.MultipleTrusteeOperation, i); ret = ERROR_INVALID_PARAMETER; diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index dfcd45b82f2..1a2e39dfe18 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -2528,11 +2528,19 @@ static void test_SetEntriesInAcl(void) ExplicitAccess.grfAccessPermissions = KEY_WRITE; ExplicitAccess.grfAccessMode = GRANT_ACCESS; ExplicitAccess.grfInheritance = NO_INHERITANCE; + ExplicitAccess.Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP; + ExplicitAccess.Trustee.TrusteeForm = TRUSTEE_IS_SID; + ExplicitAccess.Trustee.ptstrName = EveryoneSid; + ExplicitAccess.Trustee.MultipleTrusteeOperation = 0xDEADBEEF; + ExplicitAccess.Trustee.pMultipleTrustee = (PVOID)0xDEADBEEF; + res = pSetEntriesInAclW(1, &ExplicitAccess, OldAcl, &NewAcl); + ok(res == ERROR_SUCCESS, "SetEntriesInAclW failed: %u\n", res); + ok(NewAcl != NULL, "returned acl was NULL\n"); + LocalFree(NewAcl); + + ExplicitAccess.Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; ExplicitAccess.Trustee.pMultipleTrustee = NULL; ExplicitAccess.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; - ExplicitAccess.Trustee.TrusteeForm = TRUSTEE_IS_SID; - ExplicitAccess.Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; - ExplicitAccess.Trustee.ptstrName = EveryoneSid; res = pSetEntriesInAclW(1, &ExplicitAccess, OldAcl, &NewAcl); ok(res == ERROR_SUCCESS, "SetEntriesInAclW failed: %u\n", res); ok(NewAcl != NULL, "returned acl was NULL\n");