advapi32: SetEntriesInAclW() should accept account name "CURRENT_USER".

This commit is contained in:
Rein Klazes 2009-08-16 12:36:56 +02:00 committed by Alexandre Julliard
parent 1ebbab8ddb
commit b46e2ef9b1
2 changed files with 11 additions and 1 deletions

View File

@ -184,6 +184,7 @@ static const WCHAR CREATOR_GROUP[] = { 'C','R','E','A','T','O','R',' ','G','R','
static const WCHAR CREATOR_GROUP_SERVER[] = { 'C','R','E','A','T','O','R',' ','G','R','O','U','P',' ','S','E','R','V','E','R',0 };
static const WCHAR CREATOR_OWNER[] = { 'C','R','E','A','T','O','R',' ','O','W','N','E','R',0 };
static const WCHAR CREATOR_OWNER_SERVER[] = { 'C','R','E','A','T','O','R',' ','O','W','N','E','R',' ','S','E','R','V','E','R',0 };
static const WCHAR CURRENT_USER[] = { 'C','U','R','R','E','N','T','_','U','S','E','R',0 };
static const WCHAR DIALUP[] = { 'D','I','A','L','U','P',0 };
static const WCHAR Digest_Authentication[] = { 'D','i','g','e','s','t',' ','A','u','t','h','e','n','t','i','c','a','t','i','o','n',0 };
static const WCHAR DOMAIN[] = {'D','O','M','A','I','N',0};
@ -3510,7 +3511,8 @@ DWORD WINAPI SetEntriesInAclW( ULONG count, PEXPLICIT_ACCESSW pEntries,
DWORD sid_size = FIELD_OFFSET(SID, SubAuthority[SID_MAX_SUB_AUTHORITIES]);
DWORD domain_size = MAX_COMPUTERNAME_LENGTH + 1;
SID_NAME_USE use;
if (!LookupAccountNameW(NULL, pEntries[i].Trustee.ptstrName, ppsid[i], &sid_size, NULL, &domain_size, &use))
if ( strcmpW( pEntries[i].Trustee.ptstrName, CURRENT_USER ) &&
!LookupAccountNameW(NULL, pEntries[i].Trustee.ptstrName, ppsid[i], &sid_size, NULL, &domain_size, &use))
{
WARN("bad user name %s for trustee %d\n", debugstr_w(pEntries[i].Trustee.ptstrName), i);
ret = ERROR_INVALID_PARAMETER;

View File

@ -2482,6 +2482,7 @@ static void test_SetEntriesInAcl(void)
SID_IDENTIFIER_AUTHORITY SIDAuthNT = { SECURITY_NT_AUTHORITY };
EXPLICIT_ACCESSW ExplicitAccess;
static const WCHAR wszEveryone[] = {'E','v','e','r','y','o','n','e',0};
static const WCHAR wszCurrentUser[] = { 'C','U','R','R','E','N','T','_','U','S','E','R','\0'};
if (!pSetEntriesInAclW)
{
@ -2575,6 +2576,13 @@ static void test_SetEntriesInAcl(void)
LocalFree(NewAcl);
}
ExplicitAccess.Trustee.TrusteeForm = TRUSTEE_IS_USER;
ExplicitAccess.Trustee.ptstrName = (LPWSTR)wszCurrentUser;
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.grfAccessMode = REVOKE_ACCESS;
ExplicitAccess.Trustee.TrusteeForm = TRUSTEE_IS_SID;
ExplicitAccess.Trustee.ptstrName = UsersSid;