Revert changes
authorVolker Lendecke <vlendec@samba.org>
Thu, 17 Oct 2002 08:12:20 +0000 (08:12 +0000)
committerVolker Lendecke <vlendec@samba.org>
Thu, 17 Oct 2002 08:12:20 +0000 (08:12 +0000)
(This used to be commit 975fd17f8af0f03f43995deb3fdd9bd5995a1c92)

source3/groupdb/mapping.c
source3/passdb/passdb.c

index d78582e7e5dba06ba1ab752afa43adf9f454e8bf..0f05316949a1894b75a7a5ada4689cd1cd15f4e7 100644 (file)
@@ -1048,42 +1048,34 @@ Returns a GROUP_MAP struct based on the gid.
 BOOL get_group_from_gid(gid_t gid, GROUP_MAP *map, BOOL with_priv)
 {
        struct group *grp;
-       fstring name;
-       DOM_SID sid;
-       fstring string_sid;
-       PRIVILEGE_SET priv_set;
 
        if(!init_group_mapping()) {
                DEBUG(0,("failed to initialize group mapping"));
                return(False);
        }
 
-       if (get_group_map_from_gid(gid, map, with_priv))
-               return True;
-
-       /* There is no mapping, create one on the fly. This is just
-          interim, we need a RID allocator in the passdb backend. */
+       if ( (grp=getgrgid(gid)) == NULL)
+               return False;
 
-        if ((grp=getgrgid(gid)) != NULL) {
-                slprintf(name, sizeof(name), "Group %s", grp->gr_name);
-        } else {
-                slprintf(name, sizeof(name), "Group %d", gid);
-        }
+       /*
+        * make a group map from scratch if doesn't exist.
+        */
+       if (!get_group_map_from_gid(gid, map, with_priv)) {
+               map->gid=gid;
+               map->sid_name_use=SID_NAME_ALIAS;
+               map->systemaccount=PR_ACCESS_FROM_NETWORK;
+               init_privilege(&map->priv_set);
 
-       /* interim solution until we have a last RID allocated */
+               /* interim solution until we have a last RID allocated */
 
-       sid_copy(&sid, get_global_sam_sid());
-       sid_append_rid(&sid, pdb_gid_to_group_rid(gid));
-       sid_to_string(string_sid, &sid);
-       init_privilege(&priv_set);
+               sid_copy(&map->sid, get_global_sam_sid());
+               sid_append_rid(&map->sid, pdb_gid_to_group_rid(gid));
 
-       if (!add_initial_entry(gid, string_sid, SID_NAME_DOM_GRP,
-                              name, "Local Unix Group",
-                              priv_set, PR_ACCESS_FROM_NETWORK)) {
-               return False;
+               fstrcpy(map->nt_name, grp->gr_name);
+               fstrcpy(map->comment, "Local Unix Group");
        }
        
-       return get_group_map_from_gid(gid, map, with_priv);
+       return True;
 }
 
 
index dfaf7c88bef83b64bbb1a360292e8f8ac19e743c..9402f0c94c83aae447729b636eb279809a111a96 100644 (file)
@@ -897,7 +897,7 @@ DOM_SID *local_gid_to_sid(DOM_SID *psid, gid_t gid)
 
        sid_copy(psid, get_global_sam_sid());
        
-       if (get_group_from_gid(gid, &map, MAPPING_WITHOUT_PRIV)) {
+       if (get_group_map_from_gid(gid, &map, MAPPING_WITHOUT_PRIV)) {
                sid_copy(psid, &map.sid);
        } 
        else {