From 7ed5a181ac836f2f88e1525723dd6197ca3a9084 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 15 Jun 1998 22:02:14 +0000 Subject: client.c: Made -L do a null-session share unless -U user is specified. clientutil.c: Fixed NT session to add NT password. groupname.c: Added lookup function. Jeremy. (This used to be commit 8216363e83fcdccfade70f983830b56b7e6546a4) --- source3/smbd/groupname.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'source3/smbd/groupname.c') diff --git a/source3/smbd/groupname.c b/source3/smbd/groupname.c index 4cfd3e98f5..33ce3adbfe 100644 --- a/source3/smbd/groupname.c +++ b/source3/smbd/groupname.c @@ -202,3 +202,37 @@ Error was %s.\n", unixname, strerror(errno) )); fclose(fp); } + +/*********************************************************** + Lookup a SID entry by gid_t. +************************************************************/ + +void map_gid_to_sid( gid_t gid, DOM_SID *psid) +{ + groupname_map_entry *gmep; + + /* + * Initialize and load if not already loaded. + */ + load_groupname_map(); + + for( gmep = (groupname_map_entry *)ubi_slFirst( &groupname_map_list); + gmep; gmep = (groupname_map_entry *)ubi_slNext( gmep )) { + + if( gmep->unix_gid == gid) { + *psid = gmep->windows_sid; + DEBUG(7,("map_gid_to_sid: Mapping unix group %s to windows group %s.\n", + gmep->unix_name, gmep->windows_name )); + return; + } + } + + /* + * If there's no map, convert the UNIX gid_t + * to a rid within this domain SID. + */ + *psid = global_machine_sid; + psid->sub_auths[psid->num_auths++] = pdb_gid_to_group_rid(gid); + + return; +} -- cgit