diff options
author | Ralph Boehme <slow@samba.org> | 2019-07-13 16:20:11 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-09-11 19:59:34 +0000 |
commit | 1f4ec34447704dc02f08fc4f53ca988571d4769c (patch) | |
tree | 33102d8e784020d84227261d5f28d937b9171dc3 | |
parent | d836f4a7d6ffbd3719a8be8141b7a186648556dd (diff) | |
download | samba-1f4ec34447704dc02f08fc4f53ca988571d4769c.tar.gz |
smbd: rename change_to_user_by_fsp() to change_to_user_and_service_by_fsp()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/include/vfs.h | 1 | ||||
-rw-r--r-- | source3/modules/vfs_default.c | 10 | ||||
-rw-r--r-- | source3/smbd/blocking.c | 2 | ||||
-rw-r--r-- | source3/smbd/dosmode.c | 2 | ||||
-rw-r--r-- | source3/smbd/proto.h | 2 | ||||
-rw-r--r-- | source3/smbd/smb2_lock.c | 2 | ||||
-rw-r--r-- | source3/smbd/smb2_query_directory.c | 4 | ||||
-rw-r--r-- | source3/smbd/uid.c | 9 | ||||
-rw-r--r-- | source3/smbd/vfs.c | 4 |
9 files changed, 22 insertions, 14 deletions
diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 289da0c9672..342b062651a 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -279,6 +279,7 @@ /* 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 diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 4cca80ea397..f48a590e5e7 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -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); diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c index 94e75a9b405..131c74b69da 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -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; diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 173b90d2cd0..32a01c271c6 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -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, diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 7829546c987..d471e2ed2cb 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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); diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c index 381aae6cb60..162748496c2 100644 --- a/source3/smbd/smb2_lock.c +++ b/source3/smbd/smb2_lock.c @@ -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; diff --git a/source3/smbd/smb2_query_directory.c b/source3/smbd/smb2_query_directory.c index aee17cdaed6..a8ba5eaa389 100644 --- a/source3/smbd/smb2_query_directory.c +++ b/source3/smbd/smb2_query_directory.c @@ -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); diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index 2dd0d11367a..d0dcfefb31d 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -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); } diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index ddc7df1405b..20f3d34965f 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -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, |