summaryrefslogtreecommitdiff
path: root/source3/smbd/groupname.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-06-15 22:02:14 +0000
committerJeremy Allison <jra@samba.org>1998-06-15 22:02:14 +0000
commit7ed5a181ac836f2f88e1525723dd6197ca3a9084 (patch)
tree568e5369e8b3cd8629f2ee753c1e032276588a0e /source3/smbd/groupname.c
parent644fbaaf9ba38a5f3d60f27f7110e755b20d31e7 (diff)
downloadsamba-7ed5a181ac836f2f88e1525723dd6197ca3a9084.tar.gz
samba-7ed5a181ac836f2f88e1525723dd6197ca3a9084.tar.bz2
samba-7ed5a181ac836f2f88e1525723dd6197ca3a9084.zip
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)
Diffstat (limited to 'source3/smbd/groupname.c')
-rw-r--r--source3/smbd/groupname.c34
1 files changed, 34 insertions, 0 deletions
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;
+}