diff options
author | Ralph Boehme <slow@samba.org> | 2019-07-13 16:17:17 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-09-11 19:59:34 +0000 |
commit | d836f4a7d6ffbd3719a8be8141b7a186648556dd (patch) | |
tree | a53356a778900a087b060d9610c2472c3ce8a7bd /source3/smbd | |
parent | ae3cfa5da9e86a4f379df7bba8e45ef31a28bc4d (diff) | |
download | samba-d836f4a7d6ffbd3719a8be8141b7a186648556dd.tar.gz |
smbd: rename change_to_user() to change_to_user_and_service()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/process.c | 2 | ||||
-rw-r--r-- | source3/smbd/proto.h | 2 | ||||
-rw-r--r-- | source3/smbd/service.c | 4 | ||||
-rw-r--r-- | source3/smbd/smb2_server.c | 2 | ||||
-rw-r--r-- | source3/smbd/smb2_setinfo.c | 4 | ||||
-rw-r--r-- | source3/smbd/uid.c | 13 |
6 files changed, 17 insertions, 10 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c index ab3c08b27ae..0e0d45d2af1 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -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)); diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 7efbb80d3e3..7829546c987 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 7b3abe4c3e0..7e252a459b3 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -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, diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 0776fa2bdd2..5a98a2e82d4 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -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; } diff --git a/source3/smbd/smb2_setinfo.c b/source3/smbd/smb2_setinfo.c index 82abd9c9d2e..49b921cd092 100644 --- a/source3/smbd/smb2_setinfo.c +++ b/source3/smbd/smb2_setinfo.c @@ -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; diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index 8fa38e459dd..2dd0d11367a 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -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; |