]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: rename change_to_user_by_fsp() to change_to_user_and_service_by_fsp()
authorRalph Boehme <slow@samba.org>
Sat, 13 Jul 2019 14:20:11 +0000 (16:20 +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_default.c
source3/smbd/blocking.c
source3/smbd/dosmode.c
source3/smbd/proto.h
source3/smbd/smb2_lock.c
source3/smbd/smb2_query_directory.c
source3/smbd/uid.c
source3/smbd/vfs.c

index 289da0c9672886f51409e88d2a2ac4d40f32234c..342b062651ad993c556ff1d9bee08d555f1e161e 100644 (file)
 /* 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() */
+/* Version 42 - Move change_to_user_by_fsp() -> change_to_user_and_service_by_fsp() */
 
 #define SMB_VFS_INTERFACE_VERSION 42
 
index 4cca80ea397dac7adae26168b57bdb28f91035c7..f48a590e5e704be4eed9ccfe57cb6d8bbafae053 100644 (file)
@@ -1790,7 +1790,7 @@ static void vfswrap_offload_write_cleanup(struct tevent_req *req,
                return;
        }
 
-       ok = change_to_user_by_fsp(state->dst_fsp);
+       ok = change_to_user_and_service_by_fsp(state->dst_fsp);
        SMB_ASSERT(ok);
        state->dst_fsp = NULL;
 }
@@ -1906,7 +1906,7 @@ static struct tevent_req *vfswrap_offload_write_send(
                return tevent_req_post(req, ev);
        }
 
-       ok = change_to_user_by_fsp(src_fsp);
+       ok = change_to_user_and_service_by_fsp(src_fsp);
        if (!ok) {
                tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
                return tevent_req_post(req, ev);
@@ -2021,7 +2021,7 @@ static void vfswrap_offload_write_read_done(struct tevent_req *subreq)
 
        state->src_off += nread;
 
-       ok = change_to_user_by_fsp(state->dst_fsp);
+       ok = change_to_user_and_service_by_fsp(state->dst_fsp);
        if (!ok) {
                tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
                return;
@@ -2092,7 +2092,7 @@ static void vfswrap_offload_write_write_done(struct tevent_req *subreq)
                return;
        }
 
-       ok = change_to_user_by_fsp(state->src_fsp);
+       ok = change_to_user_and_service_by_fsp(state->src_fsp);
        if (!ok) {
                tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
                return;
@@ -3253,7 +3253,7 @@ static void vfswrap_getxattrat_done(struct tevent_req *subreq)
        /*
         * Make sure we run as the user again
         */
-       ok = change_to_user_by_fsp(state->dir_fsp);
+       ok = change_to_user_and_service_by_fsp(state->dir_fsp);
        SMB_ASSERT(ok);
 
        ret = pthreadpool_tevent_job_recv(subreq);
index 94e75a9b4058ea5fd7dcb4b331785ebb7000d9be..131c74b69da0e3437b87dc8784f85f0d65578934 100644 (file)
@@ -620,7 +620,7 @@ static void smbd_smb1_do_locks_retry(struct tevent_req *subreq)
        /*
         * Make sure we run as the user again
         */
-       ok = change_to_user_by_fsp(state->fsp);
+       ok = change_to_user_and_service_by_fsp(state->fsp);
        if (!ok) {
                tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
                return;
index 173b90d2cd09364d9999c21fe6a9bdf235e27a52..32a01c271c60315ec74959778c775d9d4af426cd 100644 (file)
@@ -866,7 +866,7 @@ static void dos_mode_at_vfs_get_dosmode_done(struct tevent_req *subreq)
        /*
         * Make sure we run as the user again
         */
-       ok = change_to_user_by_fsp(state->dir_fsp);
+       ok = change_to_user_and_service_by_fsp(state->dir_fsp);
        SMB_ASSERT(ok);
 
        status = SMB_VFS_GET_DOS_ATTRIBUTES_RECV(subreq,
index 7829546c987eb6cba8772459b7ccec66665dae03..d471e2ed2cb1d610091039cc673f166fce947d5a 100644 (file)
@@ -1190,7 +1190,7 @@ NTSTATUS check_user_share_access(connection_struct *conn,
                                uint32_t *p_share_access,
                                bool *p_readonly_share);
 bool change_to_user_and_service(connection_struct *conn, uint64_t vuid);
-bool change_to_user_by_fsp(struct files_struct *fsp);
+bool change_to_user_and_service_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);
 bool smbd_unbecome_authenticated_pipe_user(void);
index 381aae6cb60ce961067dced78aaa907ce1283a09..162748496c20182d9f713b87ad6ed79cc5f9cf6d 100644 (file)
@@ -579,7 +579,7 @@ static void smbd_smb2_lock_retry(struct tevent_req *subreq)
        /*
         * Make sure we run as the user again
         */
-       ok = change_to_user_by_fsp(state->fsp);
+       ok = change_to_user_and_service_by_fsp(state->fsp);
        if (!ok) {
                tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
                return;
index aee17cdaed6ff256c715c4a943f8f4ae3775848b..a8ba5eaa389c516c6dd72d1fd9c8521d7e282238 100644 (file)
@@ -736,7 +736,7 @@ static void smb2_query_directory_fetch_write_time_done(struct tevent_req *subreq
        /*
         * Make sure we run as the user again
         */
-       ok = change_to_user_by_fsp(state->fsp);
+       ok = change_to_user_and_service_by_fsp(state->fsp);
        SMB_ASSERT(ok);
 
        state->async_sharemode_count--;
@@ -765,7 +765,7 @@ static void smb2_query_directory_dos_mode_done(struct tevent_req *subreq)
        /*
         * Make sure we run as the user again
         */
-       ok = change_to_user_by_fsp(state->fsp);
+       ok = change_to_user_and_service_by_fsp(state->fsp);
        SMB_ASSERT(ok);
 
        status = fetch_dos_mode_recv(subreq);
index 2dd0d11367a4e67c11d67bccb97fd8b6757d1808..d0dcfefb31d9c6b249b6e617d54c3b91049c299e 100644 (file)
@@ -483,7 +483,14 @@ bool change_to_user_and_service(connection_struct *conn, uint64_t vuid)
        return change_to_user_internal(conn, vuser->session_info, vuid);
 }
 
-bool change_to_user_by_fsp(struct files_struct *fsp)
+/**
+ * Impersonate user and change directory to service
+ *
+ * change_to_user_and_service_by_fsp() 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_by_fsp(struct files_struct *fsp)
 {
        return change_to_user_and_service(fsp->conn, fsp->vuid);
 }
index ddc7df1405b6dcbba614aeab0ac2e253e89d3c63..20f3d34965f70c90e5f5d2e9bfa6b6daaa95a885 100644 (file)
@@ -2493,7 +2493,7 @@ static void smb_vfs_call_get_dos_attributes_done(struct tevent_req *subreq)
        /*
         * Make sure we run as the user again
         */
-       ok = change_to_user_by_fsp(state->dir_fsp);
+       ok = change_to_user_and_service_by_fsp(state->dir_fsp);
        SMB_ASSERT(ok);
 
        status = state->recv_fn(subreq,
@@ -2770,7 +2770,7 @@ static void smb_vfs_call_getxattrat_done(struct tevent_req *subreq)
        /*
         * Make sure we run as the user again
         */
-       ok = change_to_user_by_fsp(state->dir_fsp);
+       ok = change_to_user_and_service_by_fsp(state->dir_fsp);
        SMB_ASSERT(ok);
 
        state->retval = state->recv_fn(subreq,