advapi32: Make ConvertStringSidToSid not to ignore the first subauthority.

This commit is contained in:
Mikolaj Zalewski 2007-09-24 19:04:11 -07:00 committed by Alexandre Julliard
parent 57ca9ae92d
commit ff3ab48081
2 changed files with 10 additions and 2 deletions

View File

@ -3900,12 +3900,12 @@ static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
while (*StringSid)
{
pisid->SubAuthority[i++] = atoiW(StringSid);
while (*StringSid && *StringSid != '-')
StringSid++;
if (*StringSid == '-')
StringSid++;
pisid->SubAuthority[i++] = atoiW(StringSid);
}
if (i != pisid->SubAuthorityCount)

View File

@ -148,6 +148,7 @@ static void test_sid(void)
const char noSubAuthStr[] = "S-1-5";
unsigned int i;
PSID psid = NULL;
SID *pisid;
BOOL r;
LPSTR str = NULL;
@ -185,6 +186,13 @@ static void test_sid(void)
"expected GetLastError() is ERROR_INVALID_SID, got %d\n",
GetLastError() );
ok(pConvertStringSidToSidA("S-1-5-21-93476-23408-4576", &psid), "ConvertStringSidToSidA failed\n");
pisid = (SID *)psid;
ok(pisid->SubAuthorityCount == 4, "Invalid sub authority count - expected 4, got %d\n", pisid->SubAuthorityCount);
ok(pisid->SubAuthority[0] == 21, "Invalid subauthority 0 - expceted 21, got %d\n", pisid->SubAuthority[0]);
ok(pisid->SubAuthority[3] == 4576, "Invalid subauthority 0 - expceted 4576, got %d\n", pisid->SubAuthority[3]);
LocalFree(str);
for( i = 0; i < sizeof(refs) / sizeof(refs[0]); i++ )
{
PISID pisid;