smbd: let check_user_ok() construct ent->session_info in one coherent block
authorStefan Metzmacher <metze@samba.org>
Thu, 3 May 2018 13:04:30 +0000 (15:04 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 18 Jun 2018 06:59:16 +0000 (08:59 +0200)
We should finish manipulating ent->session_info before filling
conn->session_info. And conn->session_info should be not be changed.

Use git show -U15.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/uid.c

index b24ae3cc3b07da1ce5a2dc75be45d425cc4aba46..0af47831a4dec071dff7d247764a4e3976840a1e 100644 (file)
@@ -240,6 +240,14 @@ static bool check_user_ok(connection_struct *conn,
                return false;
        }
 
+       if (admin_user) {
+               DEBUG(2,("check_user_ok: user %s is an admin user. "
+                       "Setting uid as %d\n",
+                       ent->session_info->unix_info->unix_name,
+                       sec_initial_uid() ));
+               ent->session_info->unix_token->uid = sec_initial_uid();
+       }
+
        /*
         * It's actually OK to call check_user_ok() with
         * vuid == UID_FIELD_INVALID as called from change_to_user_by_session().
@@ -265,14 +273,6 @@ static bool check_user_ok(connection_struct *conn,
        conn->read_only = readonly_share;
        conn->share_access = share_access;
 
-       if (admin_user) {
-               DEBUG(2,("check_user_ok: user %s is an admin user. "
-                       "Setting uid as %d\n",
-                       conn->session_info->unix_info->unix_name,
-                       sec_initial_uid() ));
-               conn->session_info->unix_token->uid = sec_initial_uid();
-       }
-
        return(True);
 }