summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net.c7
-rw-r--r--source3/utils/net_rpc.c19
-rw-r--r--source3/utils/net_rpc_samsync.c44
-rw-r--r--source3/utils/smbgroupedit.c1
4 files changed, 32 insertions, 39 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c
index b3b72e2465..800aeded0a 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -277,13 +277,8 @@ struct cli_state *net_make_ipc_connection(unsigned flags)
} else {
nt_status = connect_to_ipc(&cli, &server_ip, server_name);
}
-
SAFE_FREE(server_name);
- if (NT_STATUS_IS_OK(nt_status)) {
- return cli;
- } else {
- return NULL;
- }
+ return cli;
}
static int net_user(int argc, const char **argv)
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 11f73a1387..8b8278b053 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -309,24 +309,15 @@ static int rpc_join_usage(int argc, const char **argv)
* Main 'net_rpc_join()' (where the admain username/password is used) is
* in net_rpc_join.c
* Assume if a -U is specified, it's the new style, otherwise it's the
- * old style. If 'oldstyle' is specfied explicity, do it and don't prompt.
+ * old style
**/
int net_rpc_join(int argc, const char **argv)
{
- struct functable func[] = {
- {"oldstyle", net_rpc_join_oldstyle},
- {NULL, NULL}
- };
-
- if (argc == 0) {
- if ((net_rpc_join_oldstyle(argc, argv) == 0))
- return 0;
-
- return net_rpc_join_newstyle(argc, argv);
- }
-
- return net_run_function(argc, argv, func, rpc_join_usage);
+ if ((net_rpc_join_oldstyle(argc, argv) == 0))
+ return 0;
+
+ return net_rpc_join_newstyle(argc, argv);
}
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index c040b3cca2..202d5b5c88 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -4,7 +4,6 @@
Copyright (C) Andrew Tridgell 2002
Copyright (C) Tim Potter 2001,2002
- Modified by Volker Lendecke 2002
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -192,6 +191,7 @@ fail:
static NTSTATUS
sam_account_from_delta(SAM_ACCOUNT *account, SAM_ACCOUNT_INFO *delta)
{
+ DOM_SID sid;
fstring s;
uchar lm_passwd[16], nt_passwd[16];
@@ -227,8 +227,13 @@ sam_account_from_delta(SAM_ACCOUNT *account, SAM_ACCOUNT_INFO *delta)
/* User and group sid */
- pdb_set_user_sid_from_rid(account, delta->user_rid);
- pdb_set_group_sid_from_rid(account, delta->group_rid);
+ sid_copy(&sid, get_global_sam_sid());
+ sid_append_rid(&sid, delta->user_rid);
+ pdb_set_user_sid(account, &sid);
+
+ sid_copy(&sid, get_global_sam_sid());
+ sid_append_rid(&sid, delta->group_rid);
+ pdb_set_group_sid(account, &sid);
/* Logon and password information */
@@ -354,10 +359,17 @@ fetch_group_info(uint32 rid, SAM_GROUP_INFO *delta)
fstring sid_string;
GROUP_MAP map;
int flag = TDB_INSERT;
+ gid_t gid;
unistr2_to_ascii(name, &delta->uni_grp_name, sizeof(name)-1);
unistr2_to_ascii(comment, &delta->uni_grp_desc, sizeof(comment)-1);
+ if ((grp = getgrnam(name)) == NULL)
+ smb_create_group(name, &gid);
+
+ if ((grp = getgrgid(gid)) == NULL)
+ return NT_STATUS_ACCESS_DENIED;
+
/* add the group to the mapping table */
sid_copy(&group_sid, get_global_sam_sid());
sid_append_rid(&group_sid, rid);
@@ -370,17 +382,17 @@ fetch_group_info(uint32 rid, SAM_GROUP_INFO *delta)
if (grp == NULL)
{
- gid_t gid;
-
+ gid_t new_gid;
/* No group found from mapping, find it from its name. */
if ((grp = getgrnam(name)) == NULL) {
/* No appropriate group found, create one */
d_printf("Creating unix group: '%s'\n", name);
- if (smb_create_group(name, &gid) != 0)
- return NT_STATUS_ACCESS_DENIED;
- if ((grp = getgrgid(gid)) == NULL)
+ if (smb_create_group(name, &new_gid) != 0)
return NT_STATUS_ACCESS_DENIED;
}
+
+ if ((grp = getgrgid(new_gid)) == NULL)
+ return NT_STATUS_ACCESS_DENIED;
}
map.gid = grp->gr_gid;
@@ -546,26 +558,22 @@ static NTSTATUS fetch_alias_info(uint32 rid, SAM_ALIAS_INFO *delta,
}
if (grp == NULL) {
- gid_t gid;
-
+ gid_t new_gid;
/* No group found from mapping, find it from its name. */
if ((grp = getgrnam(name)) == NULL) {
/* No appropriate group found, create one */
d_printf("Creating unix group: '%s'\n", name);
- if (smb_create_group(name, &gid) != 0)
- return NT_STATUS_ACCESS_DENIED;
- if ((grp = getgrgid(gid)) == NULL)
+ if (smb_create_group(name, &new_gid) != 0)
return NT_STATUS_ACCESS_DENIED;
}
+
+ if ((grp = getgrgid(new_gid)) == NULL)
+ return NT_STATUS_ACCESS_DENIED;
}
map.gid = grp->gr_gid;
map.sid = alias_sid;
-
- if (sid_equal(&dom_sid, &global_sid_Builtin))
- map.sid_name_use = SID_NAME_WKN_GRP;
- else
- map.sid_name_use = SID_NAME_ALIAS;
+ map.sid_name_use = SID_NAME_ALIAS;
fstrcpy(map.nt_name, name);
fstrcpy(map.comment, comment);
diff --git a/source3/utils/smbgroupedit.c b/source3/utils/smbgroupedit.c
index 589dafc231..cf5ac1f025 100644
--- a/source3/utils/smbgroupedit.c
+++ b/source3/utils/smbgroupedit.c
@@ -52,7 +52,6 @@ static void usage(void)
printf(" -c SID change group\n");
printf(" -u unix group\n");
printf(" -d description group description\n");
- printf(" -r rid RID of new group\n");
printf(" -x group delete this group\n");
printf("\n");
printf(" -t[b|d|l] type: builtin, domain, local \n");