passdb/util_builtin.c

説明を見る。
00001 /* 
00002    Unix SMB/CIFS implementation.
00003    Translate BUILTIN names to SIDs and vice versa
00004    Copyright (C) Volker Lendecke 2005
00005       
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015    
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 */
00020 
00021 #include "includes.h"
00022 
00023 struct rid_name_map {
00024         uint32 rid;
00025         const char *name;
00026 };
00027 
00028 static const struct rid_name_map builtin_aliases[] = {
00029         { BUILTIN_ALIAS_RID_ADMINS,             "Administrators" },
00030         { BUILTIN_ALIAS_RID_USERS,              "Users" },
00031         { BUILTIN_ALIAS_RID_GUESTS,             "Guests" },
00032         { BUILTIN_ALIAS_RID_POWER_USERS,        "Power Users" },
00033         { BUILTIN_ALIAS_RID_ACCOUNT_OPS,        "Account Operators" },
00034         { BUILTIN_ALIAS_RID_SYSTEM_OPS,         "Server Operators" },
00035         { BUILTIN_ALIAS_RID_PRINT_OPS,          "Print Operators" },
00036         { BUILTIN_ALIAS_RID_BACKUP_OPS,         "Backup Operators" },
00037         { BUILTIN_ALIAS_RID_REPLICATOR,         "Replicator" },
00038         { BUILTIN_ALIAS_RID_RAS_SERVERS,        "RAS Servers" },
00039         { BUILTIN_ALIAS_RID_PRE_2K_ACCESS,      "Pre-Windows 2000 Compatible Access" },
00040         {  0, NULL}};
00041 
00042 /*******************************************************************
00043  Look up a rid in the BUILTIN domain
00044  ********************************************************************/
00045 BOOL lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name)
00046 {
00047         const struct rid_name_map *aliases = builtin_aliases;
00048 
00049         while (aliases->name != NULL) {
00050                 if (rid == aliases->rid) {
00051                         *name = talloc_strdup(mem_ctx, aliases->name);
00052                         return True;
00053                 }
00054                 aliases++;
00055         }
00056 
00057         return False;
00058 }
00059 
00060 /*******************************************************************
00061  Look up a name in the BUILTIN domain
00062  ********************************************************************/
00063 BOOL lookup_builtin_name(const char *name, uint32 *rid)
00064 {
00065         const struct rid_name_map *aliases = builtin_aliases;
00066 
00067         while (aliases->name != NULL) {
00068                 if (strequal(name, aliases->name)) {
00069                         *rid = aliases->rid;
00070                         return True;
00071                 }
00072                 aliases++;
00073         }
00074 
00075         return False;
00076 }
00077 
00078 /*****************************************************************
00079  Return the name of the BUILTIN domain
00080 *****************************************************************/  
00081 
00082 const char *builtin_domain_name(void)
00083 {
00084         return "BUILTIN";
00085 }
00086 
00087 /*****************************************************************
00088  Check if the SID is the builtin SID (S-1-5-32).
00089 *****************************************************************/  
00090 
00091 BOOL sid_check_is_builtin(const DOM_SID *sid)
00092 {
00093         return sid_equal(sid, &global_sid_Builtin);
00094 }
00095 
00096 /*****************************************************************
00097  Check if the SID is one of the builtin SIDs (S-1-5-32-a).
00098 *****************************************************************/  
00099 
00100 BOOL sid_check_is_in_builtin(const DOM_SID *sid)
00101 {
00102         DOM_SID dom_sid;
00103         uint32 rid;
00104 
00105         sid_copy(&dom_sid, sid);
00106         sid_split_rid(&dom_sid, &rid);
00107         
00108         return sid_check_is_builtin(&dom_sid);
00109 }
00110 

Sambaに対してSat Aug 29 21:23:13 2009に生成されました。  doxygen 1.4.7