summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2011-03-17 12:35:35 +0100
committerGünther Deschner <gd@samba.org>2011-03-17 13:57:28 +0100
commit4562a7914d432fd4aff7255697246290d55c847b (patch)
tree08ef6204ecfa213c7817c644b5819a93f18d1bec /source3/utils
parent717beda638e84902ef9b78eb37e0d8e85672ffd3 (diff)
downloadsamba-4562a7914d432fd4aff7255697246290d55c847b.tar.gz
samba-4562a7914d432fd4aff7255697246290d55c847b.tar.bz2
samba-4562a7914d432fd4aff7255697246290d55c847b.zip
s3:net Find uid before using it
Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_sam.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c
index 8a9ca8ad18..af8aaa47df 100644
--- a/source3/utils/net_sam.c
+++ b/source3/utils/net_sam.c
@@ -1781,6 +1781,13 @@ doma_done:
"Admins group not available!\n"));
goto done;
}
+ if (!winbind_allocate_uid(&uid)) {
+ d_fprintf(stderr,
+ _("Unable to allocate a new uid to create "
+ "the Administrator user!\n"));
+ goto done;
+ }
+
name = talloc_strdup(tc, "Administrator");
dn = talloc_asprintf(tc, "uid=Administrator,%s", lp_ldap_user_suffix());
uidstr = talloc_asprintf(tc, "%u", (unsigned int)uid);
@@ -1801,13 +1808,6 @@ doma_done:
sid_compose(&sid, get_global_sam_sid(), DOMAIN_RID_ADMINISTRATOR);
- if (!winbind_allocate_uid(&uid)) {
- d_fprintf(stderr,
- _("Unable to allocate a new uid to create "
- "the Administrator user!\n"));
- goto done;
- }
-
smbldap_set_mod(&mods, LDAP_MOD_ADD, "objectClass", LDAP_OBJ_ACCOUNT);
smbldap_set_mod(&mods, LDAP_MOD_ADD, "objectClass", LDAP_OBJ_POSIXACCOUNT);
smbldap_set_mod(&mods, LDAP_MOD_ADD, "objectClass", LDAP_OBJ_SAMBASAMACCOUNT);