2 Unix SMB/CIFS implementation.
3 Translate BUILTIN names to SIDs and vice versa
4 Copyright (C) Volker Lendecke 2005
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "../libcli/security/security.h"
29 static const struct rid_name_map builtin_aliases[] = {
30 { BUILTIN_RID_ADMINISTRATORS, "Administrators" },
31 { BUILTIN_RID_USERS, "Users" },
32 { BUILTIN_RID_GUESTS, "Guests" },
33 { BUILTIN_RID_POWER_USERS, "Power Users" },
34 { BUILTIN_RID_ACCOUNT_OPERATORS, "Account Operators" },
35 { BUILTIN_RID_SERVER_OPERATORS, "Server Operators" },
36 { BUILTIN_RID_PRINT_OPERATORS, "Print Operators" },
37 { BUILTIN_RID_BACKUP_OPERATORS, "Backup Operators" },
38 { BUILTIN_RID_REPLICATOR, "Replicator" },
39 { BUILTIN_RID_RAS_SERVERS, "RAS Servers" },
40 { BUILTIN_RID_PRE_2K_ACCESS,
41 "Pre-Windows 2000 Compatible Access" },
42 { BUILTIN_RID_REMOTE_DESKTOP_USERS,
43 "Remote Desktop Users" },
44 { BUILTIN_RID_NETWORK_CONF_OPERATORS,
45 "Network Configuration Operators" },
46 { BUILTIN_RID_INCOMING_FOREST_TRUST,
47 "Incoming Forest Trust Builders" },
48 { BUILTIN_RID_PERFMON_USERS,
49 "Performance Monitor Users" },
50 { BUILTIN_RID_PERFLOG_USERS,
51 "Performance Log Users" },
52 { BUILTIN_RID_AUTH_ACCESS,
53 "Windows Authorization Access Group" },
54 { BUILTIN_RID_TS_LICENSE_SERVERS,
55 "Terminal Server License Servers" },
58 /*******************************************************************
59 Look up a rid in the BUILTIN domain
60 ********************************************************************/
61 bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name)
63 const struct rid_name_map *aliases = builtin_aliases;
65 while (aliases->name != NULL) {
66 if (rid == aliases->rid) {
67 *name = talloc_strdup(mem_ctx, aliases->name);
76 /*******************************************************************
77 Look up a name in the BUILTIN domain
78 ********************************************************************/
79 bool lookup_builtin_name(const char *name, uint32 *rid)
81 const struct rid_name_map *aliases = builtin_aliases;
83 while (aliases->name != NULL) {
84 if (strequal(name, aliases->name)) {
94 /*****************************************************************
95 Return the name of the BUILTIN domain
96 *****************************************************************/
98 const char *builtin_domain_name(void)
103 /*****************************************************************
104 Check if the SID is the builtin SID (S-1-5-32).
105 *****************************************************************/
107 bool sid_check_is_builtin(const struct dom_sid *sid)
109 return dom_sid_equal(sid, &global_sid_Builtin);
112 /*****************************************************************
113 Check if the SID is one of the builtin SIDs (S-1-5-32-a).
114 *****************************************************************/
116 bool sid_check_is_in_builtin(const struct dom_sid *sid)
118 struct dom_sid dom_sid;
120 sid_copy(&dom_sid, sid);
121 sid_split_rid(&dom_sid, NULL);
123 return sid_check_is_builtin(&dom_sid);