]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: rename change_to_user() to change_to_user_and_service()
authorRalph Boehme <slow@samba.org>
Sat, 13 Jul 2019 14:17:17 +0000 (16:17 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 11 Sep 2019 19:59:34 +0000 (19:59 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/vfs.h
source3/modules/vfs_aio_pthread.c
source3/smbd/process.c
source3/smbd/proto.h
source3/smbd/service.c
source3/smbd/smb2_server.c
source3/smbd/smb2_setinfo.c
source3/smbd/uid.c

index d164e91e88611e59318ee3996909ab85653eaf35..289da0c9672886f51409e88d2a2ac4d40f32234c 100644 (file)
 /* Version 42 - Move SMB_VFS_READLINK -> SMB_VFS_READLINKAT. */
 /* Version 42 - Move SMB_VFS_SYMLINK -> SMB_VFS_SYMLINKAT. */
 /* Version 42 - Move SMB_VFS_MKDIR -> SMB_VFS_MKDIRAT. */
+/* Version 42 - Move change_to_user() -> change_to_user_and_service() */
 
 #define SMB_VFS_INTERFACE_VERSION 42
 
index 577180b6b01e9f02b2d4fddaa55b5557ef5a1f28..a7d97223dbdf1dc5a128243a13763f9e39f25081 100644 (file)
@@ -105,7 +105,7 @@ static void aio_open_handle_completion(struct tevent_req *subreq)
                /*
                 * Make sure we run as the user again
                 */
-               ok = change_to_user(opd->conn, opd->conn->vuid);
+               ok = change_to_user_and_service(opd->conn, opd->conn->vuid);
                if (!ok) {
                        smb_panic("Can't change to user");
                        return;
index ab3c08b27ae854d91305f8c6ffe9c74e9b1bd3a0..0e0d45d2af13971c106572382d4369d04ad83777 100644 (file)
@@ -1626,7 +1626,7 @@ static connection_struct *switch_message(uint8_t type, struct smb_request *req)
                 * change_to_user() implies set_current_user_info()
                 * and chdir_connect_service().
                 */
-               if (!change_to_user(conn,session_tag)) {
+               if (!change_to_user_and_service(conn,session_tag)) {
                        DEBUG(0, ("Error: Could not change to user. Removing "
                                "deferred open, mid=%llu.\n",
                                (unsigned long long)req->mid));
index 7efbb80d3e31cb506fedf6b8580077ed46392119..7829546c987eb6cba8772459b7ccec66665dae03 100644 (file)
@@ -1189,7 +1189,7 @@ NTSTATUS check_user_share_access(connection_struct *conn,
                                const struct auth_session_info *session_info,
                                uint32_t *p_share_access,
                                bool *p_readonly_share);
-bool change_to_user(connection_struct *conn, uint64_t vuid);
+bool change_to_user_and_service(connection_struct *conn, uint64_t vuid);
 bool change_to_user_by_fsp(struct files_struct *fsp);
 bool smbd_change_to_root_user(void);
 bool smbd_become_authenticated_pipe_user(struct auth_session_info *session_info);
index 7b3abe4c3e097ecdb3b6cf926b04b86870a32080..7e252a459b3a6fc0e527e748596aba2d3bc33bcd 100644 (file)
@@ -747,7 +747,7 @@ static NTSTATUS make_connection_snum(struct smbXsrv_connection *xconn,
        }
 
 /* USER Activites: */
-       if (!change_to_user(conn, conn->vuid)) {
+       if (!change_to_user_and_service(conn, conn->vuid)) {
                /* No point continuing if they fail the basic checks */
                DEBUG(0,("Can't become connected user!\n"));
                status = NT_STATUS_LOGON_FAILURE;
@@ -1162,7 +1162,7 @@ void close_cnum(connection_struct *conn, uint64_t vuid)
 
        /* execute any "postexec = " line */
        if (*lp_postexec(talloc_tos(), SNUM(conn)) &&
-           change_to_user(conn, vuid))  {
+           change_to_user_and_service(conn, vuid))  {
                char *cmd = talloc_sub_advanced(talloc_tos(),
                                        lp_const_servicename(SNUM(conn)),
                                        conn->session_info->unix_info->unix_name,
index 0776fa2bdd2156a7fdcaaaba5e46fd7c7421612a..5a98a2e82d4d4e21b9f07ed4d28f966dffe15621 100644 (file)
@@ -1883,7 +1883,7 @@ static NTSTATUS smbd_smb2_request_check_tcon(struct smbd_smb2_request *req)
                return status;
        }
 
-       if (!change_to_user(tcon->compat, req->session->compat->vuid)) {
+       if (!change_to_user_and_service(tcon->compat, req->session->compat->vuid)) {
                return NT_STATUS_ACCESS_DENIED;
        }
 
index 82abd9c9d2e5e33023218895d5e595b074e7c0fc..49b921cd0920e2dbef68a55bb3bbeb34c712f135 100644 (file)
@@ -295,8 +295,8 @@ static void defer_rename_done(struct tevent_req *subreq)
        /*
         * Make sure we run as the user again
         */
-       ok = change_to_user(state->smb2req->tcon->compat,
-                           state->smb2req->session->compat->vuid);
+       ok = change_to_user_and_service(state->smb2req->tcon->compat,
+                                       state->smb2req->session->compat->vuid);
        if (!ok) {
                tevent_req_nterror(state->req, NT_STATUS_ACCESS_DENIED);
                return;
index 8fa38e459dd2812a767f9b38b44586d2f5f2ee9f..2dd0d11367a4e67c11d67bccb97fd8b6757d1808 100644 (file)
@@ -454,7 +454,14 @@ static bool change_to_user_internal(connection_struct *conn,
        return true;
 }
 
-bool change_to_user(connection_struct *conn, uint64_t vuid)
+/**
+ * Impersonate user and change directory to service
+ *
+ * change_to_user_and_service() is used to impersonate the user associated with
+ * the given vuid and to change the working directory of the process to the
+ * service base directory.
+ **/
+bool change_to_user_and_service(connection_struct *conn, uint64_t vuid)
 {
        struct user_struct *vuser;
        int snum = SNUM(conn);
@@ -478,7 +485,7 @@ bool change_to_user(connection_struct *conn, uint64_t vuid)
 
 bool change_to_user_by_fsp(struct files_struct *fsp)
 {
-       return change_to_user(fsp->conn, fsp->vuid);
+       return change_to_user_and_service(fsp->conn, fsp->vuid);
 }
 
 static bool change_to_user_by_session(connection_struct *conn,
@@ -661,7 +668,7 @@ bool become_user(connection_struct *conn, uint64_t vuid)
 
        push_conn_ctx();
 
-       if (!change_to_user(conn, vuid)) {
+       if (!change_to_user_and_service(conn, vuid)) {
                pop_sec_ctx();
                pop_conn_ctx();
                return False;