]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:winbind_user: move initialization of domain up in winbindd_fill_pwent()
authorMichael Adam <obnox@samba.org>
Sun, 1 Feb 2009 23:35:43 +0000 (00:35 +0100)
committerMichael Adam <obnox@samba.org>
Sun, 1 Feb 2009 23:53:04 +0000 (00:53 +0100)
and streamline logic some

Michael

source3/winbindd/winbindd_user.c

index 5356e16a74d599b8e31f8dcece3ea15c4ca64fd5..2e326430fc10fb83558078ae07aec60da6c4f350 100644 (file)
@@ -80,6 +80,13 @@ static bool winbindd_fill_pwent(TALLOC_CTX *ctx, char *dom_name, char *user_name
        if (!pw || !dom_name || !user_name)
                return False;
 
+       domain = find_domain_from_name_noinit(dom_name);
+       if (domain == NULL) {
+               DEBUG(5,("winbindd_fill_pwent: Failed to find domain for %s.  "
+                        "Disabling name alias support\n", dom_name));
+               nt_status = NT_STATUS_NO_SUCH_DOMAIN;
+       }
+
        /* Resolve the uid number */
 
        if (!NT_STATUS_IS_OK(idmap_sid_to_uid(dom_name, user_sid,
@@ -98,19 +105,10 @@ static bool winbindd_fill_pwent(TALLOC_CTX *ctx, char *dom_name, char *user_name
                return False;
        }
 
-       strlower_m(user_name);
-
        /* Username */
 
-       domain = find_domain_from_name_noinit(dom_name);
-       if (domain) {
-               nt_status = normalize_name_map(ctx, domain, user_name,
-                                              &mapped_name);
-       } else {
-               DEBUG(5,("winbindd_fill_pwent: Failed to find domain for %s.  "
-                        "Disabling name alias support\n", dom_name));
-               nt_status = NT_STATUS_NO_SUCH_DOMAIN;
-       }
+       strlower_m(user_name);
+       nt_status = normalize_name_map(ctx, domain, user_name, &mapped_name);
 
        /* Basic removal of whitespace */
        if (NT_STATUS_IS_OK(nt_status)) {