advapi32: Allow string alias for common RID in sid strings.
This commit is contained in:
parent
1b2aacc97b
commit
f7a6c4c323
|
@ -138,24 +138,25 @@ static const WELLKNOWNSID WellKnownSids[] =
|
||||||
/* these SIDs must be constructed as relative to some domain - only the RID is well-known */
|
/* these SIDs must be constructed as relative to some domain - only the RID is well-known */
|
||||||
typedef struct WELLKNOWNRID
|
typedef struct WELLKNOWNRID
|
||||||
{
|
{
|
||||||
|
WCHAR wstr[2];
|
||||||
WELL_KNOWN_SID_TYPE Type;
|
WELL_KNOWN_SID_TYPE Type;
|
||||||
DWORD Rid;
|
DWORD Rid;
|
||||||
} WELLKNOWNRID;
|
} WELLKNOWNRID;
|
||||||
|
|
||||||
static const WELLKNOWNRID WellKnownRids[] = {
|
static const WELLKNOWNRID WellKnownRids[] = {
|
||||||
{ WinAccountAdministratorSid, DOMAIN_USER_RID_ADMIN },
|
{ {'L','A'}, WinAccountAdministratorSid, DOMAIN_USER_RID_ADMIN },
|
||||||
{ WinAccountGuestSid, DOMAIN_USER_RID_GUEST },
|
{ {'L','G'}, WinAccountGuestSid, DOMAIN_USER_RID_GUEST },
|
||||||
{ WinAccountKrbtgtSid, DOMAIN_USER_RID_KRBTGT },
|
{ {0,0}, WinAccountKrbtgtSid, DOMAIN_USER_RID_KRBTGT },
|
||||||
{ WinAccountDomainAdminsSid, DOMAIN_GROUP_RID_ADMINS },
|
{ {0,0}, WinAccountDomainAdminsSid, DOMAIN_GROUP_RID_ADMINS },
|
||||||
{ WinAccountDomainUsersSid, DOMAIN_GROUP_RID_USERS },
|
{ {0,0}, WinAccountDomainUsersSid, DOMAIN_GROUP_RID_USERS },
|
||||||
{ WinAccountDomainGuestsSid, DOMAIN_GROUP_RID_GUESTS },
|
{ {0,0}, WinAccountDomainGuestsSid, DOMAIN_GROUP_RID_GUESTS },
|
||||||
{ WinAccountComputersSid, DOMAIN_GROUP_RID_COMPUTERS },
|
{ {0,0}, WinAccountComputersSid, DOMAIN_GROUP_RID_COMPUTERS },
|
||||||
{ WinAccountControllersSid, DOMAIN_GROUP_RID_CONTROLLERS },
|
{ {0,0}, WinAccountControllersSid, DOMAIN_GROUP_RID_CONTROLLERS },
|
||||||
{ WinAccountCertAdminsSid, DOMAIN_GROUP_RID_CERT_ADMINS },
|
{ {0,0}, WinAccountCertAdminsSid, DOMAIN_GROUP_RID_CERT_ADMINS },
|
||||||
{ WinAccountSchemaAdminsSid, DOMAIN_GROUP_RID_SCHEMA_ADMINS },
|
{ {0,0}, WinAccountSchemaAdminsSid, DOMAIN_GROUP_RID_SCHEMA_ADMINS },
|
||||||
{ WinAccountEnterpriseAdminsSid, DOMAIN_GROUP_RID_ENTERPRISE_ADMINS },
|
{ {0,0}, WinAccountEnterpriseAdminsSid, DOMAIN_GROUP_RID_ENTERPRISE_ADMINS },
|
||||||
{ WinAccountPolicyAdminsSid, DOMAIN_GROUP_RID_POLICY_ADMINS },
|
{ {0,0}, WinAccountPolicyAdminsSid, DOMAIN_GROUP_RID_POLICY_ADMINS },
|
||||||
{ WinAccountRasAndIasServersSid, DOMAIN_ALIAS_RID_RAS_SERVERS },
|
{ {0,0}, WinAccountRasAndIasServersSid, DOMAIN_ALIAS_RID_RAS_SERVERS },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -5257,6 +5258,15 @@ static DWORD ComputeStringSidSize(LPCWSTR StringSid)
|
||||||
for (i = 0; i < sizeof(WellKnownSids)/sizeof(WellKnownSids[0]); i++)
|
for (i = 0; i < sizeof(WellKnownSids)/sizeof(WellKnownSids[0]); i++)
|
||||||
if (!strncmpW(WellKnownSids[i].wstr, StringSid, 2))
|
if (!strncmpW(WellKnownSids[i].wstr, StringSid, 2))
|
||||||
return GetSidLengthRequired(WellKnownSids[i].Sid.SubAuthorityCount);
|
return GetSidLengthRequired(WellKnownSids[i].Sid.SubAuthorityCount);
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(WellKnownRids)/sizeof(WellKnownRids[0]); i++)
|
||||||
|
if (!strncmpW(WellKnownRids[i].wstr, StringSid, 2))
|
||||||
|
{
|
||||||
|
MAX_SID local;
|
||||||
|
ADVAPI_GetComputerSid(&local);
|
||||||
|
return GetSidLengthRequired(*GetSidSubAuthorityCount(&local) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetSidLengthRequired(0);
|
return GetSidLengthRequired(0);
|
||||||
|
@ -5284,7 +5294,7 @@ static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
|
||||||
*cBytes = ComputeStringSidSize(StringSid);
|
*cBytes = ComputeStringSidSize(StringSid);
|
||||||
if (!pisid) /* Simply compute the size */
|
if (!pisid) /* Simply compute the size */
|
||||||
{
|
{
|
||||||
TRACE("only size requested, returning TRUE\n");
|
TRACE("only size requested, returning TRUE with %d\n", *cBytes);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5363,6 +5373,15 @@ static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
|
||||||
bret = TRUE;
|
bret = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(WellKnownRids)/sizeof(WellKnownRids[0]); i++)
|
||||||
|
if (!strncmpW(WellKnownRids[i].wstr, StringSid, 2))
|
||||||
|
{
|
||||||
|
ADVAPI_GetComputerSid(pisid);
|
||||||
|
pisid->SubAuthority[pisid->SubAuthorityCount] = WellKnownRids[i].Rid;
|
||||||
|
pisid->SubAuthorityCount++;
|
||||||
|
bret = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!bret)
|
if (!bret)
|
||||||
FIXME("String constant not supported: %s\n", debugstr_wn(StringSid, 2));
|
FIXME("String constant not supported: %s\n", debugstr_wn(StringSid, 2));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue