summaryrefslogtreecommitdiff
path: root/source3/groupdb
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-07-16 02:20:53 +0000
committerGerald Carter <jerry@samba.org>2003-07-16 02:20:53 +0000
commita84270ce115e7fa0674c163de708333816184dca (patch)
treefbad9af11ddfae189f1dd003590f50dbb4407c47 /source3/groupdb
parent6b814c9908c307abf427af37c00332de5e369eb4 (diff)
downloadsamba-a84270ce115e7fa0674c163de708333816184dca.tar.gz
samba-a84270ce115e7fa0674c163de708333816184dca.tar.bz2
samba-a84270ce115e7fa0674c163de708333816184dca.zip
fixes for 'net rpc vampire'. I can now take a blank Samba host
and migrate an NT4 domain and still logon from domain members (tested logon scripts, system policies, profiles, & home directories) (passdb backend = tdbsam) removed call to idmap_init_wellknown_sids() from winbindd.c since the local domain should be handled by the guest passdb backend (and you don't really always want the Administrator account to be root) ...and we didn't pay attention to this anyways now. (This used to be commit 837d7c54d3ca780160aa0d6a2f0a109bb691948e)
Diffstat (limited to 'source3/groupdb')
-rw-r--r--source3/groupdb/mapping.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c
index 951361f4d4..3d2af5d0ba 100644
--- a/source3/groupdb/mapping.c
+++ b/source3/groupdb/mapping.c
@@ -714,8 +714,10 @@ BOOL get_uid_list_of_group(gid_t gid, uid_t **uid, int *num_uids)
int smb_create_group(char *unix_group, gid_t *new_gid)
{
pstring add_script;
- int ret;
- int fd = 0;
+ int ret = -1;
+ int fd = 0;
+
+ *new_gid = 0;
/* defer to scripts */
@@ -734,22 +736,9 @@ int smb_create_group(char *unix_group, gid_t *new_gid)
if (read(fd, output, sizeof(output)) > 0) {
*new_gid = (gid_t)strtoul(output, NULL, 10);
}
+
close(fd);
-
- if (*new_gid == 0) {
- /* The output was garbage. We assume nobody
- will create group 0 via smbd. Now we try to
- get the group via getgrnam. */
-
- struct group *grp = getgrnam(unix_group);
- if (grp != NULL)
- *new_gid = grp->gr_gid;
- else
- return 1;
- }
}
-
- return 0;
}
/* Try winbindd */
@@ -757,10 +746,17 @@ int smb_create_group(char *unix_group, gid_t *new_gid)
if ( winbind_create_group( unix_group, NULL ) ) {
DEBUG(3,("smb_create_group: winbindd created the group (%s)\n",
unix_group));
- return 0;
+ ret = 0;
+ }
+
+ if (*new_gid == 0) {
+ struct group *grp = getgrnam(unix_group);
+
+ if (grp != NULL)
+ *new_gid = grp->gr_gid;
}
- return -1;
+ return ret;
}
/****************************************************************************