Commit e27ae38f authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Fix BuildTrusteeWithSid, implement and test BuildTrusteeWithName.

parent cc3af243
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
@ stdcall BackupEventLogW (long wstr) @ stdcall BackupEventLogW (long wstr)
@ stub BuildExplicitAccessWithNameA @ stub BuildExplicitAccessWithNameA
@ stub BuildExplicitAccessWithNameW @ stub BuildExplicitAccessWithNameW
@ stub BuildTrusteeWithNameA # (ptr str) @ stdcall BuildTrusteeWithNameA(ptr str)
@ stub BuildTrusteeWithNameW # (ptr wstr) @ stdcall BuildTrusteeWithNameW(ptr wstr)
@ stub BuildTrusteeWithObjectsAndNameA # (ptr ptr long str str str) @ stub BuildTrusteeWithObjectsAndNameA # (ptr ptr long str str str)
@ stub BuildTrusteeWithObjectsAndNameW # (ptr ptr long wstr wstr wstr) @ stub BuildTrusteeWithObjectsAndNameW # (ptr ptr long wstr wstr wstr)
@ stub BuildTrusteeWithObjectsAndSidA # (ptr ptr ptr ptr ptr) @ stub BuildTrusteeWithObjectsAndSidA # (ptr ptr ptr ptr ptr)
......
...@@ -1519,8 +1519,7 @@ VOID WINAPI BuildTrusteeWithSidA(PTRUSTEEA pTrustee, PSID pSid) ...@@ -1519,8 +1519,7 @@ VOID WINAPI BuildTrusteeWithSidA(PTRUSTEEA pTrustee, PSID pSid)
pTrustee->pMultipleTrustee = NULL; pTrustee->pMultipleTrustee = NULL;
pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
pTrustee->TrusteeForm = NO_MULTIPLE_TRUSTEE; pTrustee->TrusteeForm = TRUSTEE_IS_SID;
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
pTrustee->ptstrName = (LPSTR) pSid; pTrustee->ptstrName = (LPSTR) pSid;
} }
...@@ -1534,13 +1533,40 @@ VOID WINAPI BuildTrusteeWithSidW(PTRUSTEEW pTrustee, PSID pSid) ...@@ -1534,13 +1533,40 @@ VOID WINAPI BuildTrusteeWithSidW(PTRUSTEEW pTrustee, PSID pSid)
pTrustee->pMultipleTrustee = NULL; pTrustee->pMultipleTrustee = NULL;
pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
pTrustee->TrusteeForm = NO_MULTIPLE_TRUSTEE; pTrustee->TrusteeForm = TRUSTEE_IS_SID;
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
pTrustee->ptstrName = (LPWSTR) pSid; pTrustee->ptstrName = (LPWSTR) pSid;
} }
/****************************************************************************** /******************************************************************************
* BuildTrusteeWithNameA [ADVAPI32.@]
*/
VOID WINAPI BuildTrusteeWithNameA(PTRUSTEEA pTrustee, LPSTR name)
{
TRACE("%p %s\n", pTrustee, debugstr_a(name) );
pTrustee->pMultipleTrustee = NULL;
pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
pTrustee->TrusteeForm = TRUSTEE_IS_NAME;
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
pTrustee->ptstrName = name;
}
/******************************************************************************
* BuildTrusteeWithNameW [ADVAPI32.@]
*/
VOID WINAPI BuildTrusteeWithNameW(PTRUSTEEW pTrustee, LPWSTR name)
{
TRACE("%p %s\n", pTrustee, debugstr_w(name) );
pTrustee->pMultipleTrustee = NULL;
pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
pTrustee->TrusteeForm = TRUSTEE_IS_NAME;
pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
pTrustee->ptstrName = name;
}
/******************************************************************************
* SetEntriesInAclA [ADVAPI32.@] * SetEntriesInAclA [ADVAPI32.@]
*/ */
DWORD WINAPI SetEntriesInAclA( ULONG count, PEXPLICIT_ACCESSA pEntries, DWORD WINAPI SetEntriesInAclA( ULONG count, PEXPLICIT_ACCESSA pEntries,
......
...@@ -62,6 +62,7 @@ void test_trustee() ...@@ -62,6 +62,7 @@ void test_trustee()
TRUSTEE trustee; TRUSTEE trustee;
PSID psid; PSID psid;
DWORD r; DWORD r;
LPSTR str = "2jjj";
SID_IDENTIFIER_AUTHORITY auth = { {0x11,0x22,0,0,0, 0} }; SID_IDENTIFIER_AUTHORITY auth = { {0x11,0x22,0,0,0, 0} };
...@@ -78,8 +79,19 @@ void test_trustee() ...@@ -78,8 +79,19 @@ void test_trustee()
ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n"); ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n");
ok( trustee.ptstrName == (LPSTR) psid, "ptstrName wrong\n" ); ok( trustee.ptstrName == (LPSTR) psid, "ptstrName wrong\n" );
FreeSid( psid ); FreeSid( psid );
}
/* test BuildTrusteeWithNameA */
memset( &trustee, 0xff, sizeof trustee );
BuildTrusteeWithNameA( &trustee, str );
ok( trustee.pMultipleTrustee == NULL, "pMultipleTrustee wrong\n");
ok( trustee.MultipleTrusteeOperation == NO_MULTIPLE_TRUSTEE,
"MultipleTrusteeOperation wrong\n");
ok( trustee.TrusteeForm == TRUSTEE_IS_NAME, "TrusteeForm wrong\n");
ok( trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, "TrusteeType wrong\n");
ok( trustee.ptstrName == str, "ptstrName wrong\n" );
}
START_TEST(security) START_TEST(security)
{ {
test_sid(); test_sid();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment