diff options
author | Jeremy Allison <jra@samba.org> | 2022-08-17 11:43:47 -0700 |
---|---|---|
committer | Jule Anger <janger@samba.org> | 2022-08-23 07:45:16 +0000 |
commit | ce464a83c76ce612171f3df4933058695210915e (patch) | |
tree | ca55ef8e4e22b17a5bc2af6d67e88d40d712ae5f | |
parent | a5cf33d4041d44f1f8a80563b81f3bc6893bc7ce (diff) | |
download | samba-ce464a83c76ce612171f3df4933058695210915e.tar.gz |
s3: smbd: Plumb close_type parameter through close_file_in_loop(), file_close_conn()
Allows close_file_in_loop() to differentiate between SHUTDOWN_CLOSE
(previously it only used this close type) and ERROR_CLOSE - called
on error from smbXsrv_tcon_disconnect() in the error path. In that
case we want to close the fd, but not run any delete-on-close actions.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15128
Signed-off-by: Jeremy Allison <jra@samba.org>
Reivewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Thu Aug 18 14:10:18 UTC 2022 on sn-devel-184
(cherry picked from commit cf5f7b1489930f6d64c3e3512f116ccf286d4605)
-rw-r--r-- | source3/smbd/files.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 7996d62bc91..e2591b4d77d 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -752,7 +752,8 @@ NTSTATUS parent_pathref(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -static bool close_file_in_loop(struct files_struct *fsp) +static bool close_file_in_loop(struct files_struct *fsp, + enum file_close_type close_type) { if (fsp->base_fsp != NULL) { /* @@ -770,7 +771,7 @@ static bool close_file_in_loop(struct files_struct *fsp) fsp->base_fsp->stream_fsp = NULL; fsp->base_fsp = NULL; - close_file_free(NULL, &fsp, SHUTDOWN_CLOSE); + close_file_free(NULL, &fsp, close_type); return NULL; } @@ -794,7 +795,7 @@ static bool close_file_in_loop(struct files_struct *fsp) return false; } - close_file_free(NULL, &fsp, SHUTDOWN_CLOSE); + close_file_free(NULL, &fsp, close_type); return true; } @@ -804,6 +805,7 @@ static bool close_file_in_loop(struct files_struct *fsp) struct file_close_conn_state { struct connection_struct *conn; + enum file_close_type close_type; bool fsp_left_behind; }; @@ -825,7 +827,7 @@ static struct files_struct *file_close_conn_fn( fsp->op->global->durable = false; } - did_close = close_file_in_loop(fsp); + did_close = close_file_in_loop(fsp, state->close_type); if (!did_close) { state->fsp_left_behind = true; } @@ -835,7 +837,8 @@ static struct files_struct *file_close_conn_fn( void file_close_conn(connection_struct *conn, enum file_close_type close_type) { - struct file_close_conn_state state = { .conn = conn }; + struct file_close_conn_state state = { .conn = conn, + .close_type = close_type }; files_forall(conn->sconn, file_close_conn_fn, &state); @@ -921,7 +924,7 @@ static struct files_struct *file_close_user_fn( return NULL; } - did_close = close_file_in_loop(fsp); + did_close = close_file_in_loop(fsp, SHUTDOWN_CLOSE); if (!did_close) { state->fsp_left_behind = true; } |