Reputation: 139
I'm trying to define the type of entered credentials with:
SID_NAME_USE pe;
...
resolved=LookupAccountNameW (NULL,L"builtin\users",&sid,&cbsid,buff,&dd,&pe);
No matter if I enter "builtin\users" or "users" it resolves successfully but returns SidTypeAlias in pe enum. But I expect SidTypeWellKnownGroup or SidTypeGroup.
Question: How to reliably define if given string is a Windows Group name ?
Upvotes: 1
Views: 1156
Reputation: 1083
The Glossary of the Security Account Manager Remote Protocol specification gives some hints as to what SidTypeAlias might be:
alias object: See resource group.
resource group: A group object whose membership is added to the authorization context only if the server receiving the context is a member of the same domain as the resource group.
This suggests that "alias" means "Domain Local group" in this context.
I confirmed this in my domain, by obtaining all domain groups using DirectorySearcher and calling LookupAccountName on each. Results:
Bottom line - SidTypeAlias should be treated as a group.
Upvotes: 2
Reputation: 36328
The MSDN page Well-known SIDs briefly describes the meaning of "alias" in this context:
The following table has examples of domain-relative RIDs that you can use to form well-known SIDs for local groups (aliases).
One of the table entries is for the Users group, so the behaviour you are describing is as expected.
You can continue to use LookupAccountName() as you planned, you simply need to modify your code to recognize that any of SidTypeAlias, SidTypeWellKnownGroup, or SidTypeGroup represent groups.
Upvotes: 4