[PATCH] advapi32: Allow string alias for common RID in sid strings
Detlef Riekenberg
wine.dev at web.de
Fri Oct 26 13:03:09 CDT 2012
"LA" is needed for the office 2013 installer:
http://bugs.winehq.org/show_bug.cgi?id=31349
Current tests dump the results for "LA" and "LS"
--
By by ... Detlef
---
dlls/advapi32/security.c | 47 ++++++++++++++++++++++++++++++++-------------
1 files changed, 33 insertions(+), 14 deletions(-)
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index c86ca17..699c8e0 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -138,24 +138,25 @@ static const WELLKNOWNSID WellKnownSids[] =
/* these SIDs must be constructed as relative to some domain - only the RID is well-known */
typedef struct WELLKNOWNRID
{
+ WCHAR wstr[2];
WELL_KNOWN_SID_TYPE Type;
DWORD Rid;
} WELLKNOWNRID;
static const WELLKNOWNRID WellKnownRids[] = {
- { WinAccountAdministratorSid, DOMAIN_USER_RID_ADMIN },
- { WinAccountGuestSid, DOMAIN_USER_RID_GUEST },
- { WinAccountKrbtgtSid, DOMAIN_USER_RID_KRBTGT },
- { WinAccountDomainAdminsSid, DOMAIN_GROUP_RID_ADMINS },
- { WinAccountDomainUsersSid, DOMAIN_GROUP_RID_USERS },
- { WinAccountDomainGuestsSid, DOMAIN_GROUP_RID_GUESTS },
- { WinAccountComputersSid, DOMAIN_GROUP_RID_COMPUTERS },
- { WinAccountControllersSid, DOMAIN_GROUP_RID_CONTROLLERS },
- { WinAccountCertAdminsSid, DOMAIN_GROUP_RID_CERT_ADMINS },
- { WinAccountSchemaAdminsSid, DOMAIN_GROUP_RID_SCHEMA_ADMINS },
- { WinAccountEnterpriseAdminsSid, DOMAIN_GROUP_RID_ENTERPRISE_ADMINS },
- { WinAccountPolicyAdminsSid, DOMAIN_GROUP_RID_POLICY_ADMINS },
- { WinAccountRasAndIasServersSid, DOMAIN_ALIAS_RID_RAS_SERVERS },
+ { {'L','A'}, WinAccountAdministratorSid, DOMAIN_USER_RID_ADMIN },
+ { {'L','G'}, WinAccountGuestSid, DOMAIN_USER_RID_GUEST },
+ { {0,0}, WinAccountKrbtgtSid, DOMAIN_USER_RID_KRBTGT },
+ { {0,0}, WinAccountDomainAdminsSid, DOMAIN_GROUP_RID_ADMINS },
+ { {0,0}, WinAccountDomainUsersSid, DOMAIN_GROUP_RID_USERS },
+ { {0,0}, WinAccountDomainGuestsSid, DOMAIN_GROUP_RID_GUESTS },
+ { {0,0}, WinAccountComputersSid, DOMAIN_GROUP_RID_COMPUTERS },
+ { {0,0}, WinAccountControllersSid, DOMAIN_GROUP_RID_CONTROLLERS },
+ { {0,0}, WinAccountCertAdminsSid, DOMAIN_GROUP_RID_CERT_ADMINS },
+ { {0,0}, WinAccountSchemaAdminsSid, DOMAIN_GROUP_RID_SCHEMA_ADMINS },
+ { {0,0}, WinAccountEnterpriseAdminsSid, DOMAIN_GROUP_RID_ENTERPRISE_ADMINS },
+ { {0,0}, WinAccountPolicyAdminsSid, DOMAIN_GROUP_RID_POLICY_ADMINS },
+ { {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++)
if (!strncmpW(WellKnownSids[i].wstr, StringSid, 2))
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);
@@ -5284,7 +5294,7 @@ static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
*cBytes = ComputeStringSidSize(StringSid);
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;
}
@@ -5363,6 +5373,15 @@ static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
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)
FIXME("String constant not supported: %s\n", debugstr_wn(StringSid, 2));
}
--
1.7.5.4
More information about the wine-patches
mailing list