From 4562a7914d432fd4aff7255697246290d55c847b Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Thu, 17 Mar 2011 12:35:35 +0100 Subject: s3:net Find uid before using it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Günther Deschner --- source3/utils/net_sam.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/utils') 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); -- cgit