diff options
author | Stefan Metzmacher <metze@samba.org> | 2019-07-16 14:20:33 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-09-11 21:16:57 +0000 |
commit | 35cd91ee4d8fcd1034787882fb2e2e2ab9f8bd34 (patch) | |
tree | 99424bffc7bed81750794e19dab79757859a8bb4 | |
parent | e9256b306ecd4299aa96b27d81800382414572a9 (diff) | |
download | samba-35cd91ee4d8fcd1034787882fb2e2e2ab9f8bd34.tar.gz |
smbd: remove unused current_user.{need,done}_chdir stacking
All become_*()/unbecome_*() functions don't alter the working
directory. Only change_to_user_and_service*() does.
Pair-Programmed-With: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Sep 11 21:16:57 UTC 2019 on sn-devel-184
-rw-r--r-- | source3/include/smb.h | 2 | ||||
-rw-r--r-- | source3/smbd/globals.h | 2 | ||||
-rw-r--r-- | source3/smbd/uid.c | 32 |
3 files changed, 1 insertions, 35 deletions
diff --git a/source3/include/smb.h b/source3/include/smb.h index 41c27806489..012ed485494 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -152,8 +152,6 @@ struct sys_notify_context { struct current_user { struct connection_struct *conn; uint64_t vuid; /* SMB2 compat */ - bool need_chdir; - bool done_chdir; struct security_unix_token ut; struct security_token *nt_user_token; }; diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index a612a42f63b..8f6ce4b0266 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -89,8 +89,6 @@ extern uint16_t fnf_handle; struct conn_ctx { connection_struct *conn; uint64_t vuid; - bool need_chdir; - bool done_chdir; userdom_struct user_info; }; /* A stack of current_user connection contexts. */ diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index 487caaa87ee..304d3f818f7 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -53,8 +53,6 @@ bool change_to_guest(void) current_user.conn = NULL; current_user.vuid = UID_FIELD_INVALID; - current_user.need_chdir = false; - current_user.done_chdir = false; TALLOC_FREE(pass); @@ -460,15 +458,11 @@ bool change_to_user_and_service(connection_struct *conn, uint64_t vuid) return false; } - current_user.need_chdir = conn->tcon_done; - current_user.done_chdir = false; - - if (current_user.need_chdir) { + if (conn->tcon_done) { ok = chdir_current_service(conn); if (!ok) { return false; } - current_user.done_chdir = true; } print_impersonation_info(conn); @@ -501,8 +495,6 @@ bool smbd_change_to_root_user(void) current_user.conn = NULL; current_user.vuid = UID_FIELD_INVALID; - current_user.need_chdir = false; - current_user.done_chdir = false; return(True); } @@ -564,8 +556,6 @@ static void push_conn_ctx(void) ctx_p->conn = current_user.conn; ctx_p->vuid = current_user.vuid; - ctx_p->need_chdir = current_user.need_chdir; - ctx_p->done_chdir = current_user.done_chdir; ctx_p->user_info = current_user_info; DEBUG(4, ("push_conn_ctx(%llu) : conn_ctx_stack_ndx = %d\n", @@ -592,25 +582,8 @@ static void pop_conn_ctx(void) ctx_p->user_info.unix_name, ctx_p->user_info.domain); - /* - * Check if the current context did a chdir_current_service() - * and restore the cwd_fname of the previous context - * if needed. - */ - if (current_user.done_chdir && ctx_p->need_chdir) { - int ret; - - ret = vfs_ChDir(ctx_p->conn, ctx_p->conn->cwd_fsp->fsp_name); - if (ret != 0) { - DBG_ERR("vfs_ChDir() failed!\n"); - smb_panic("vfs_ChDir() failed!\n"); - } - } - current_user.conn = ctx_p->conn; current_user.vuid = ctx_p->vuid; - current_user.need_chdir = ctx_p->need_chdir; - current_user.done_chdir = ctx_p->done_chdir; *ctx_p = (struct conn_ctx) { .vuid = UID_FIELD_INVALID, @@ -633,9 +606,6 @@ void smbd_become_root(void) } push_conn_ctx(); set_root_sec_ctx(); - - current_user.need_chdir = false; - current_user.done_chdir = false; } /* Unbecome the root user */ |