s3:net sam provision: allocate the uid after composing the sid for Administrator
authorMichael Adam <obnox@samba.org>
Thu, 22 Jan 2009 11:12:43 +0000 (12:12 +0100)
committerMichael Adam <obnox@samba.org>
Sat, 14 Aug 2010 00:10:30 +0000 (02:10 +0200)
Michael

source3/utils/net_sam.c

index e02837fbc61349f951bf446430f19115ebeb2343..bd88a526029c3f4261a7c6e6f82519087cc7277e 100644 (file)
@@ -1780,12 +1780,6 @@ 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);
@@ -1806,6 +1800,13 @@ 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);