2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: Local Security Authority (LSA) Server
4 * FILE: reactos/dll/win32/lsasrv/sids.c
5 * PURPOSE: Sid / Name lookup functions
7 * PROGRAMMERS: Eric Kohl
11 WINE_DEFAULT_DEBUG_CHANNEL(lsasrv
);
14 typedef struct _WELL_KNOWN_SID
19 UNICODE_STRING Domain
;
21 } WELL_KNOWN_SID
, *PWELL_KNOWN_SID
;
24 static SID_IDENTIFIER_AUTHORITY NullSidAuthority
= {SECURITY_NULL_SID_AUTHORITY
};
25 static SID_IDENTIFIER_AUTHORITY WorldSidAuthority
= {SECURITY_WORLD_SID_AUTHORITY
};
26 static SID_IDENTIFIER_AUTHORITY LocalSidAuthority
= {SECURITY_LOCAL_SID_AUTHORITY
};
27 static SID_IDENTIFIER_AUTHORITY CreatorSidAuthority
= {SECURITY_CREATOR_SID_AUTHORITY
};
28 static SID_IDENTIFIER_AUTHORITY NtAuthority
= {SECURITY_NT_AUTHORITY
};
30 LIST_ENTRY WellKnownSidListHead
;
35 typedef struct _AccountSid
37 WELL_KNOWN_SID_TYPE type
;
40 SID_NAME_USE name_use
;
43 static const WCHAR Account_Operators
[] = { 'A','c','c','o','u','n','t',' ','O','p','e','r','a','t','o','r','s',0 };
44 static const WCHAR Administrator
[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r',0 };
45 static const WCHAR Administrators
[] = { 'A','d','m','i','n','i','s','t','r','a','t','o','r','s',0 };
46 static const WCHAR ANONYMOUS_LOGON
[] = { 'A','N','O','N','Y','M','O','U','S',' ','L','O','G','O','N',0 };
47 static const WCHAR Authenticated_Users
[] = { 'A','u','t','h','e','n','t','i','c','a','t','e','d',' ','U','s','e','r','s',0 };
48 static const WCHAR Backup_Operators
[] = { 'B','a','c','k','u','p',' ','O','p','e','r','a','t','o','r','s',0 };
49 static const WCHAR BATCH
[] = { 'B','A','T','C','H',0 };
50 static const WCHAR Blank
[] = { 0 };
51 static const WCHAR BUILTIN
[] = { 'B','U','I','L','T','I','N',0 };
52 static const WCHAR Cert_Publishers
[] = { 'C','e','r','t',' ','P','u','b','l','i','s','h','e','r','s',0 };
53 static const WCHAR CREATOR_GROUP
[] = { 'C','R','E','A','T','O','R',' ','G','R','O','U','P',0 };
54 static const WCHAR CREATOR_GROUP_SERVER
[] = { 'C','R','E','A','T','O','R',' ','G','R','O','U','P',' ','S','E','R','V','E','R',0 };
55 static const WCHAR CREATOR_OWNER
[] = { 'C','R','E','A','T','O','R',' ','O','W','N','E','R',0 };
56 static const WCHAR CREATOR_OWNER_SERVER
[] = { 'C','R','E','A','T','O','R',' ','O','W','N','E','R',' ','S','E','R','V','E','R',0 };
57 static const WCHAR DIALUP
[] = { 'D','I','A','L','U','P',0 };
58 static const WCHAR Digest_Authentication
[] = { 'D','i','g','e','s','t',' ','A','u','t','h','e','n','t','i','c','a','t','i','o','n',0 };
59 static const WCHAR DOMAIN
[] = {'D','O','M','A','I','N',0};
60 static const WCHAR Domain_Admins
[] = { 'D','o','m','a','i','n',' ','A','d','m','i','n','s',0 };
61 static const WCHAR Domain_Computers
[] = { 'D','o','m','a','i','n',' ','C','o','m','p','u','t','e','r','s',0 };
62 static const WCHAR Domain_Controllers
[] = { 'D','o','m','a','i','n',' ','C','o','n','t','r','o','l','l','e','r','s',0 };
63 static const WCHAR Domain_Guests
[] = { 'D','o','m','a','i','n',' ','G','u','e','s','t','s',0 };
64 static const WCHAR Domain_Users
[] = { 'D','o','m','a','i','n',' ','U','s','e','r','s',0 };
65 static const WCHAR Enterprise_Admins
[] = { 'E','n','t','e','r','p','r','i','s','e',' ','A','d','m','i','n','s',0 };
66 static const WCHAR ENTERPRISE_DOMAIN_CONTROLLERS
[] = { 'E','N','T','E','R','P','R','I','S','E',' ','D','O','M','A','I','N',' ','C','O','N','T','R','O','L','L','E','R','S',0 };
67 static const WCHAR Everyone
[] = { 'E','v','e','r','y','o','n','e',0 };
68 static const WCHAR Group_Policy_Creator_Owners
[] = { 'G','r','o','u','p',' ','P','o','l','i','c','y',' ','C','r','e','a','t','o','r',' ','O','w','n','e','r','s',0 };
69 static const WCHAR Guest
[] = { 'G','u','e','s','t',0 };
70 static const WCHAR Guests
[] = { 'G','u','e','s','t','s',0 };
71 static const WCHAR INTERACTIVE
[] = { 'I','N','T','E','R','A','C','T','I','V','E',0 };
72 static const WCHAR LOCAL
[] = { 'L','O','C','A','L',0 };
73 static const WCHAR LOCAL_SERVICE
[] = { 'L','O','C','A','L',' ','S','E','R','V','I','C','E',0 };
74 static const WCHAR NETWORK
[] = { 'N','E','T','W','O','R','K',0 };
75 static const WCHAR Network_Configuration_Operators
[] = { 'N','e','t','w','o','r','k',' ','C','o','n','f','i','g','u','r','a','t','i','o','n',' ','O','p','e','r','a','t','o','r','s',0 };
76 static const WCHAR NETWORK_SERVICE
[] = { 'N','E','T','W','O','R','K',' ','S','E','R','V','I','C','E',0 };
77 static const WCHAR NT_AUTHORITY
[] = { 'N','T',' ','A','U','T','H','O','R','I','T','Y',0 };
78 static const WCHAR NT_Pseudo_Domain
[] = { 'N','T',' ','P','s','e','u','d','o',' ','D','o','m','a','i','n',0 };
79 static const WCHAR NTML_Authentication
[] = { 'N','T','M','L',' ','A','u','t','h','e','n','t','i','c','a','t','i','o','n',0 };
80 static const WCHAR NULL_SID
[] = { 'N','U','L','L',' ','S','I','D',0 };
81 static const WCHAR Other_Organization
[] = { 'O','t','h','e','r',' ','O','r','g','a','n','i','z','a','t','i','o','n',0 };
82 static const WCHAR Performance_Log_Users
[] = { 'P','e','r','f','o','r','m','a','n','c','e',' ','L','o','g',' ','U','s','e','r','s',0 };
83 static const WCHAR Performance_Monitor_Users
[] = { 'P','e','r','f','o','r','m','a','n','c','e',' ','M','o','n','i','t','o','r',' ','U','s','e','r','s',0 };
84 static const WCHAR Power_Users
[] = { 'P','o','w','e','r',' ','U','s','e','r','s',0 };
85 static const WCHAR Pre_Windows_2000_Compatible_Access
[] = { 'P','r','e','-','W','i','n','d','o','w','s',' ','2','0','0','0',' ','C','o','m','p','a','t','i','b','l','e',' ','A','c','c','e','s','s',0 };
86 static const WCHAR Print_Operators
[] = { 'P','r','i','n','t',' ','O','p','e','r','a','t','o','r','s',0 };
87 static const WCHAR PROXY
[] = { 'P','R','O','X','Y',0 };
88 static const WCHAR RAS_and_IAS_Servers
[] = { 'R','A','S',' ','a','n','d',' ','I','A','S',' ','S','e','r','v','e','r','s',0 };
89 static const WCHAR Remote_Desktop_Users
[] = { 'R','e','m','o','t','e',' ','D','e','s','k','t','o','p',' ','U','s','e','r','s',0 };
90 static const WCHAR REMOTE_INTERACTIVE_LOGON
[] = { 'R','E','M','O','T','E',' ','I','N','T','E','R','A','C','T','I','V','E',' ','L','O','G','O','N',0 };
91 static const WCHAR Replicators
[] = { 'R','e','p','l','i','c','a','t','o','r','s',0 };
92 static const WCHAR RESTRICTED
[] = { 'R','E','S','T','R','I','C','T','E','D',0 };
93 static const WCHAR SChannel_Authentication
[] = { 'S','C','h','a','n','n','e','l',' ','A','u','t','h','e','n','t','i','c','a','t','i','o','n',0 };
94 static const WCHAR Schema_Admins
[] = { 'S','c','h','e','m','a',' ','A','d','m','i','n','s',0 };
95 static const WCHAR SELF
[] = { 'S','E','L','F',0 };
96 static const WCHAR Server_Operators
[] = { 'S','e','r','v','e','r',' ','O','p','e','r','a','t','o','r','s',0 };
97 static const WCHAR SERVICE
[] = { 'S','E','R','V','I','C','E',0 };
98 static const WCHAR SYSTEM
[] = { 'S','Y','S','T','E','M',0 };
99 static const WCHAR TERMINAL_SERVER_USER
[] = { 'T','E','R','M','I','N','A','L',' ','S','E','R','V','E','R',' ','U','S','E','R',0 };
100 static const WCHAR This_Organization
[] = { 'T','h','i','s',' ','O','r','g','a','n','i','z','a','t','i','o','n',0 };
101 static const WCHAR Users
[] = { 'U','s','e','r','s',0 };
103 static const AccountSid ACCOUNT_SIDS
[] = {
104 // { WinNullSid, NULL_SID, Blank, SidTypeWellKnownGroup },
105 // { WinWorldSid, Everyone, Blank, SidTypeWellKnownGroup },
106 // { WinLocalSid, LOCAL, Blank, SidTypeWellKnownGroup },
107 // { WinCreatorOwnerSid, CREATOR_OWNER, Blank, SidTypeWellKnownGroup },
108 // { WinCreatorGroupSid, CREATOR_GROUP, Blank, SidTypeWellKnownGroup },
109 // { WinCreatorOwnerServerSid, CREATOR_OWNER_SERVER, Blank, SidTypeWellKnownGroup },
110 // { WinCreatorGroupServerSid, CREATOR_GROUP_SERVER, Blank, SidTypeWellKnownGroup },
111 // { WinNtAuthoritySid, NT_Pseudo_Domain, NT_Pseudo_Domain, SidTypeDomain },
112 // { WinDialupSid, DIALUP, NT_AUTHORITY, SidTypeWellKnownGroup },
113 // { WinNetworkSid, NETWORK, NT_AUTHORITY, SidTypeWellKnownGroup },
114 // { WinBatchSid, BATCH, NT_AUTHORITY, SidTypeWellKnownGroup },
115 // { WinInteractiveSid, INTERACTIVE, NT_AUTHORITY, SidTypeWellKnownGroup },
116 // { WinServiceSid, SERVICE, NT_AUTHORITY, SidTypeWellKnownGroup },
117 // { WinAnonymousSid, ANONYMOUS_LOGON, NT_AUTHORITY, SidTypeWellKnownGroup },
118 // { WinProxySid, PROXY, NT_AUTHORITY, SidTypeWellKnownGroup },
119 // { WinEnterpriseControllersSid, ENTERPRISE_DOMAIN_CONTROLLERS, NT_AUTHORITY, SidTypeWellKnownGroup },
120 // { WinSelfSid, SELF, NT_AUTHORITY, SidTypeWellKnownGroup },
121 // { WinAuthenticatedUserSid, Authenticated_Users, NT_AUTHORITY, SidTypeWellKnownGroup },
122 // { WinRestrictedCodeSid, RESTRICTED, NT_AUTHORITY, SidTypeWellKnownGroup },
123 // { WinTerminalServerSid, TERMINAL_SERVER_USER, NT_AUTHORITY, SidTypeWellKnownGroup },
124 // { WinRemoteLogonIdSid, REMOTE_INTERACTIVE_LOGON, NT_AUTHORITY, SidTypeWellKnownGroup },
125 // { WinLocalSystemSid, SYSTEM, NT_AUTHORITY, SidTypeWellKnownGroup },
126 // { WinLocalServiceSid, LOCAL_SERVICE, NT_AUTHORITY, SidTypeWellKnownGroup },
127 // { WinNetworkServiceSid, NETWORK_SERVICE, NT_AUTHORITY, SidTypeWellKnownGroup },
128 // { WinBuiltinDomainSid, BUILTIN, BUILTIN, SidTypeDomain },
129 // { WinBuiltinAdministratorsSid, Administrators, BUILTIN, SidTypeAlias },
130 // { WinBuiltinUsersSid, Users, BUILTIN, SidTypeAlias },
131 // { WinBuiltinGuestsSid, Guests, BUILTIN, SidTypeAlias },
132 // { WinBuiltinPowerUsersSid, Power_Users, BUILTIN, SidTypeAlias },
133 // { WinBuiltinAccountOperatorsSid, Account_Operators, BUILTIN, SidTypeAlias },
134 // { WinBuiltinSystemOperatorsSid, Server_Operators, BUILTIN, SidTypeAlias },
135 // { WinBuiltinPrintOperatorsSid, Print_Operators, BUILTIN, SidTypeAlias },
136 // { WinBuiltinBackupOperatorsSid, Backup_Operators, BUILTIN, SidTypeAlias },
137 // { WinBuiltinReplicatorSid, Replicators, BUILTIN, SidTypeAlias },
138 // { WinBuiltinPreWindows2000CompatibleAccessSid, Pre_Windows_2000_Compatible_Access, BUILTIN, SidTypeAlias },
139 // { WinBuiltinRemoteDesktopUsersSid, Remote_Desktop_Users, BUILTIN, SidTypeAlias },
140 // { WinBuiltinNetworkConfigurationOperatorsSid, Network_Configuration_Operators, BUILTIN, SidTypeAlias },
141 { WinNTLMAuthenticationSid
, NTML_Authentication
, NT_AUTHORITY
, SidTypeWellKnownGroup
},
142 { WinDigestAuthenticationSid
, Digest_Authentication
, NT_AUTHORITY
, SidTypeWellKnownGroup
},
143 { WinSChannelAuthenticationSid
, SChannel_Authentication
, NT_AUTHORITY
, SidTypeWellKnownGroup
},
144 // { WinThisOrganizationSid, This_Organization, NT_AUTHORITY, SidTypeWellKnownGroup },
145 { WinOtherOrganizationSid
, Other_Organization
, NT_AUTHORITY
, SidTypeWellKnownGroup
},
146 { WinBuiltinPerfMonitoringUsersSid
, Performance_Monitor_Users
, BUILTIN
, SidTypeAlias
},
147 { WinBuiltinPerfLoggingUsersSid
, Performance_Log_Users
, BUILTIN
, SidTypeAlias
},
153 LsapCreateSid(PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
,
154 UCHAR SubAuthorityCount
,
155 PULONG SubAuthorities
,
158 SID_NAME_USE NameUse
)
160 PWELL_KNOWN_SID SidEntry
;
164 SidEntry
= RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(WELL_KNOWN_SID
));
165 if (SidEntry
== NULL
)
168 InitializeListHead(&SidEntry
->ListEntry
);
170 SidEntry
->Sid
= RtlAllocateHeap(RtlGetProcessHeap(),
172 RtlLengthRequiredSid(SubAuthorityCount
));
173 if (SidEntry
->Sid
== NULL
)
175 RtlFreeHeap(RtlGetProcessHeap(), 0, SidEntry
);
179 RtlInitializeSid(SidEntry
->Sid
,
183 for (i
= 0; i
< (ULONG
)SubAuthorityCount
; i
++)
185 p
= RtlSubAuthoritySid(SidEntry
->Sid
, i
);
186 *p
= SubAuthorities
[i
];
189 RtlInitUnicodeString(&SidEntry
->Name
,
192 RtlInitUnicodeString(&SidEntry
->Domain
,
195 SidEntry
->NameUse
= NameUse
;
197 InsertTailList(&WellKnownSidListHead
,
198 &SidEntry
->ListEntry
);
207 ULONG SubAuthorities
[5];
209 InitializeListHead(&WellKnownSidListHead
);
212 SubAuthorities
[0] = SECURITY_NULL_RID
;
213 LsapCreateSid(&NullSidAuthority
,
218 SidTypeWellKnownGroup
);
221 SubAuthorities
[0] = SECURITY_WORLD_RID
;
222 LsapCreateSid(&WorldSidAuthority
,
227 SidTypeWellKnownGroup
);
230 SubAuthorities
[0] = SECURITY_LOCAL_RID
;
231 LsapCreateSid(&LocalSidAuthority
,
236 SidTypeWellKnownGroup
);
238 /* Creator Owner Sid */
239 SubAuthorities
[0] = SECURITY_CREATOR_OWNER_RID
;
240 LsapCreateSid(&CreatorSidAuthority
,
245 SidTypeWellKnownGroup
);
247 /* Creator Group Sid */
248 SubAuthorities
[0] = SECURITY_CREATOR_GROUP_RID
;
249 LsapCreateSid(&CreatorSidAuthority
,
254 SidTypeWellKnownGroup
);
256 /* Creator Owner Server Sid */
257 SubAuthorities
[0] = SECURITY_CREATOR_OWNER_SERVER_RID
;
258 LsapCreateSid(&CreatorSidAuthority
,
261 L
"CREATOR OWNER SERVER",
263 SidTypeWellKnownGroup
);
265 /* Creator Group Server Sid */
266 SubAuthorities
[0] = SECURITY_CREATOR_GROUP_SERVER_RID
;
267 LsapCreateSid(&CreatorSidAuthority
,
270 L
"CREATOR GROUP SERVER",
272 SidTypeWellKnownGroup
);
275 LsapCreateSid(&NtAuthority
,
283 SubAuthorities
[0] = SECURITY_DIALUP_RID
;
284 LsapCreateSid(&NtAuthority
,
289 SidTypeWellKnownGroup
);
292 SubAuthorities
[0] = SECURITY_NETWORK_RID
;
293 LsapCreateSid(&NtAuthority
,
298 SidTypeWellKnownGroup
);
301 SubAuthorities
[0] = SECURITY_BATCH_RID
;
302 LsapCreateSid(&NtAuthority
,
307 SidTypeWellKnownGroup
);
309 /* Interactive Sid */
310 SubAuthorities
[0] = SECURITY_INTERACTIVE_RID
;
311 LsapCreateSid(&NtAuthority
,
316 SidTypeWellKnownGroup
);
319 SubAuthorities
[0] = SECURITY_SERVICE_RID
;
320 LsapCreateSid(&NtAuthority
,
325 SidTypeWellKnownGroup
);
327 /* Anonymous Logon Sid */
328 SubAuthorities
[0] = SECURITY_ANONYMOUS_LOGON_RID
;
329 LsapCreateSid(&NtAuthority
,
334 SidTypeWellKnownGroup
);
337 SubAuthorities
[0] = SECURITY_PROXY_RID
;
338 LsapCreateSid(&NtAuthority
,
343 SidTypeWellKnownGroup
);
345 /* Enterprise Controllers Sid */
346 SubAuthorities
[0] = SECURITY_ENTERPRISE_CONTROLLERS_RID
;
347 LsapCreateSid(&NtAuthority
,
350 L
"ENTERPRISE DOMAIN CONTROLLERS",
352 SidTypeWellKnownGroup
);
354 /* Principal Self Sid */
355 SubAuthorities
[0] = SECURITY_PRINCIPAL_SELF_RID
;
356 LsapCreateSid(&NtAuthority
,
361 SidTypeWellKnownGroup
);
363 /* Authenticated Users Sid */
364 SubAuthorities
[0] = SECURITY_AUTHENTICATED_USER_RID
;
365 LsapCreateSid(&NtAuthority
,
368 L
"Authenticated Users",
370 SidTypeWellKnownGroup
);
372 /* Restricted Code Sid */
373 SubAuthorities
[0] = SECURITY_RESTRICTED_CODE_RID
;
374 LsapCreateSid(&NtAuthority
,
379 SidTypeWellKnownGroup
);
381 /* Terminal Server Sid */
382 SubAuthorities
[0] = SECURITY_TERMINAL_SERVER_RID
;
383 LsapCreateSid(&NtAuthority
,
386 L
"TERMINAL SERVER USER",
388 SidTypeWellKnownGroup
);
390 /* Remote Logon Sid */
391 SubAuthorities
[0] = SECURITY_REMOTE_LOGON_RID
;
392 LsapCreateSid(&NtAuthority
,
395 L
"REMOTE INTERACTIVE LOGON",
397 SidTypeWellKnownGroup
);
399 /* This Organization Sid */
400 SubAuthorities
[0] = SECURITY_THIS_ORGANIZATION_RID
;
401 LsapCreateSid(&NtAuthority
,
404 L
"This Organization",
406 SidTypeWellKnownGroup
);
408 /* Local System Sid */
409 SubAuthorities
[0] = SECURITY_LOCAL_SYSTEM_RID
;
410 LsapCreateSid(&NtAuthority
,
415 SidTypeWellKnownGroup
);
417 /* Local Service Sid */
418 SubAuthorities
[0] = SECURITY_LOCAL_SERVICE_RID
;
419 LsapCreateSid(&NtAuthority
,
424 SidTypeWellKnownGroup
);
426 /* Network Service Sid */
427 SubAuthorities
[0] = SECURITY_NETWORK_SERVICE_RID
;
428 LsapCreateSid(&NtAuthority
,
433 SidTypeWellKnownGroup
);
435 /* Builtin Domain Sid */
436 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
437 LsapCreateSid(&NtAuthority
,
444 /* Administrators Alias Sid */
445 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
446 SubAuthorities
[1] = DOMAIN_ALIAS_RID_ADMINS
;
447 LsapCreateSid(&NtAuthority
,
454 /* Users Alias Sid */
455 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
456 SubAuthorities
[1] = DOMAIN_ALIAS_RID_USERS
;
457 LsapCreateSid(&NtAuthority
,
464 /* Guests Alias Sid */
465 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
466 SubAuthorities
[1] = DOMAIN_ALIAS_RID_GUESTS
;
467 LsapCreateSid(&NtAuthority
,
474 /* Power User Alias Sid */
475 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
476 SubAuthorities
[1] = DOMAIN_ALIAS_RID_POWER_USERS
;
477 LsapCreateSid(&NtAuthority
,
484 /* Account Operators Alias Sid */
485 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
486 SubAuthorities
[1] = DOMAIN_ALIAS_RID_ACCOUNT_OPS
;
487 LsapCreateSid(&NtAuthority
,
490 L
"Account Operators",
494 /* System Operators Alias Sid */
495 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
496 SubAuthorities
[1] = DOMAIN_ALIAS_RID_SYSTEM_OPS
;
497 LsapCreateSid(&NtAuthority
,
504 /* Print Operators Alias Sid */
505 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
506 SubAuthorities
[1] = DOMAIN_ALIAS_RID_PRINT_OPS
;
507 LsapCreateSid(&NtAuthority
,
514 /* Backup Operators Alias Sid */
515 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
516 SubAuthorities
[1] = DOMAIN_ALIAS_RID_BACKUP_OPS
;
517 LsapCreateSid(&NtAuthority
,
524 /* Replicators Alias Sid */
525 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
526 SubAuthorities
[1] = DOMAIN_ALIAS_RID_REPLICATOR
;
527 LsapCreateSid(&NtAuthority
,
535 /* RAS Servers Alias Sid */
536 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
537 SubAuthorities
[1] = DOMAIN_ALIAS_RID_RAS_SERVERS
;
538 LsapCreateSid(&NtAuthority
,
546 /* Pre-Windows 2000 Compatible Access Alias Sid */
547 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
548 SubAuthorities
[1] = DOMAIN_ALIAS_RID_PREW2KCOMPACCESS
;
549 LsapCreateSid(&NtAuthority
,
552 L
"Pre-Windows 2000 Compatible Access",
556 /* Remote Desktop Users Alias Sid */
557 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
558 SubAuthorities
[1] = DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS
;
559 LsapCreateSid(&NtAuthority
,
562 L
"Remote Desktop Users",
566 /* Network Configuration Operators Alias Sid */
567 SubAuthorities
[0] = SECURITY_BUILTIN_DOMAIN_RID
;
568 SubAuthorities
[1] = DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS
;
569 LsapCreateSid(&NtAuthority
,
572 L
"Network Configuration Operators",
576 /* FIXME: Add more well known sids */
578 return STATUS_SUCCESS
;
583 LsapLookupWellKnownSid(PSID Sid
)
585 PLIST_ENTRY ListEntry
;
588 ListEntry
= WellKnownSidListHead
.Flink
;
589 while (ListEntry
!= &WellKnownSidListHead
)
591 Ptr
= CONTAINING_RECORD(ListEntry
,
594 if (RtlEqualSid(Sid
, Ptr
->Sid
))
599 ListEntry
= ListEntry
->Flink
;
607 LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer
,
608 PLSAPR_TRANSLATED_NAME OutputNames
)
610 static const UNICODE_STRING UserName
= RTL_CONSTANT_STRING(L
"Administrator");
616 PSID
*Sids
= (PSID
*) SidEnumBuffer
->SidInfo
;
618 TRACE("LsapLookupSids(%p, %p)\n", SidEnumBuffer
, OutputNames
);
619 TRACE("SidEnumBuffer->Entries: %lu\n", SidEnumBuffer
->Entries
);
620 TRACE("SidEnumBuffer->SidInfo: %p\n", SidEnumBuffer
->SidInfo
);
622 for (i
= 0; i
< SidEnumBuffer
->Entries
; i
++)
624 TRACE("i: %lu\n", i
);
625 ptr
= LsapLookupWellKnownSid(Sids
[i
]);
628 OutputNames
[i
].Use
= ptr
->NameUse
;
630 OutputNames
[i
].DomainIndex
= i
; /* Fixme */
632 OutputNames
[i
].Name
.Buffer
= MIDL_user_allocate(ptr
->Name
.MaximumLength
);
633 OutputNames
[i
].Name
.Length
= ptr
->Name
.Length
;
634 OutputNames
[i
].Name
.MaximumLength
= ptr
->Name
.MaximumLength
;
635 RtlCopyMemory(OutputNames
[i
].Name
.Buffer
, ptr
->Name
.Buffer
, ptr
->Name
.MaximumLength
);
641 OutputNames
[i
].Use
= SidTypeWellKnownGroup
;
642 OutputNames
[i
].DomainIndex
= i
;
643 OutputNames
[i
].Name
.Buffer
= MIDL_user_allocate(UserName
.MaximumLength
);
644 OutputNames
[i
].Name
.Length
= UserName
.Length
;
645 OutputNames
[i
].Name
.MaximumLength
= UserName
.MaximumLength
;
646 RtlCopyMemory(OutputNames
[i
].Name
.Buffer
, UserName
.Buffer
, UserName
.MaximumLength
);
653 Status
= STATUS_NONE_MAPPED
;
654 else if (Mapped
< SidEnumBuffer
->Entries
)
655 Status
= STATUS_SOME_NOT_MAPPED
;
657 Status
= STATUS_SUCCESS
;