smbd: Simplify create_token_from_sid()
authorVolker Lendecke <vl@samba.org>
Tue, 10 Mar 2015 20:09:53 +0000 (21:09 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 11 Mar 2015 15:11:08 +0000 (16:11 +0100)
With the previous commit all 3 branches do the same

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/auth/token_util.c

index bb87be34c4c3006dc48fe2da59f7cc8f02faa76a..6129cadb48c7dd3534d07243406b4873a66ed6af 100644 (file)
@@ -716,8 +716,6 @@ static NTSTATUS create_token_from_sid(TALLOC_CTX *mem_ctx,
                /* see the smb_panic() in pdb_default_enum_group_memberships */
                SMB_ASSERT(num_group_sids > 0);
 
-               *gid = gids[0];
-
                /* Ensure we're returning the found_username on the right context. */
                *found_username = talloc_strdup(mem_ctx,
                                                pdb_get_username(sam_acct));
@@ -813,8 +811,6 @@ static NTSTATUS create_token_from_sid(TALLOC_CTX *mem_ctx,
                /* In getgroups_unix_user we always set the primary gid */
                SMB_ASSERT(num_group_sids > 0);
 
-               *gid = gids[0];
-
                /* Ensure we're returning the found_username on the right context. */
                *found_username = talloc_strdup(mem_ctx, pass->pw_name);
                if (*found_username == NULL) {
@@ -862,11 +858,11 @@ static NTSTATUS create_token_from_sid(TALLOC_CTX *mem_ctx,
                        goto done;
                }
 
-               *gid = gids[0];
-
                *found_username = NULL;
        }
 
+       *gid = gids[0];
+
        /* Add the "Unix Group" SID for each gid to catch mapped groups
           and their Unix equivalent.  This is to solve the backwards
           compatibility problem of 'valid users = +ntadmin' where