s3:net sam provision: compose sid before getting uid for Guest
[amitay/samba.git] / source3 / utils / net_sam.c
index bd88a526029c3f4261a7c6e6f82519087cc7277e..44a0b79e185fe4b6c0f00c0d1f2ede401d87e3e5 100644 (file)
@@ -1853,6 +1853,8 @@ doma_done:
 
                d_printf(_("Adding the Guest user.\n"));
 
+               sid_compose(&sid, get_global_sam_sid(), DOMAIN_RID_GUEST);
+
                pwd = getpwnam_alloc(tc, lp_guestaccount());
 
                if (!pwd) {
@@ -1882,8 +1884,6 @@ doma_done:
                        }
                }
 
-               sid_compose(&sid, get_global_sam_sid(), DOMAIN_RID_GUEST);
-
                dn = talloc_asprintf(tc, "uid=%s,%s", pwd->pw_name, lp_ldap_user_suffix ());
                uidstr = talloc_asprintf(tc, "%u", (unsigned int)pwd->pw_uid);
                gidstr = talloc_asprintf(tc, "%u", (unsigned int)pwd->pw_gid);