From b0824cf35feb893db9e7ec33aced8194279b1daf Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Fri, 3 Apr 2020 07:43:38 +0200 Subject: [PATCH] smbd: move files_struct.initial_delete_on_close to a bitfield Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/include/vfs.h | 2 +- source3/smbd/close.c | 4 ++-- source3/smbd/durable.c | 2 +- source3/smbd/open.c | 4 ++-- source3/smbd/reply.c | 2 +- source3/smbd/smb2_close.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 92f240c61b4..adb64c61e70 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -368,6 +368,7 @@ typedef struct files_struct { bool modified : 1; bool is_directory : 1; bool aio_write_behind : 1; + bool initial_delete_on_close : 1; } fsp_flags; struct tevent_timer *update_write_time_event; @@ -388,7 +389,6 @@ typedef struct files_struct { struct lock_struct last_lock_failure; int current_lock_count; /* Count the number of outstanding locks and pending locks. */ - bool initial_delete_on_close; /* Only set at NTCreateX if file was created. */ bool delete_on_close; uint64_t posix_flags; bool is_sparse; diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 05ee03d2484..5207a6b67c4 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -338,7 +338,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, } } - if (fsp->initial_delete_on_close && + if (fsp->fsp_flags.initial_delete_on_close && !is_delete_on_close_set(lck, fsp->name_hash)) { bool became_user = False; @@ -1126,7 +1126,7 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp, return NT_STATUS_INVALID_PARAMETER; } - if (fsp->initial_delete_on_close) { + if (fsp->fsp_flags.initial_delete_on_close) { bool became_user = False; /* Initial delete on close was set - for diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c index f01df16ec92..f557c51aa69 100644 --- a/source3/smbd/durable.c +++ b/source3/smbd/durable.c @@ -180,7 +180,7 @@ NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp, * For now let it be simple and do not keep * delete on close files durable open */ - if (fsp->initial_delete_on_close) { + if (fsp->fsp_flags.initial_delete_on_close) { return NT_STATUS_NOT_SUPPORTED; } if (fsp->delete_on_close) { diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 5fe5c1e58dc..9eccd623176 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3955,7 +3955,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, } /* Note that here we set the *initial* delete on close flag, not the regular one. The magic gets handled in close. */ - fsp->initial_delete_on_close = True; + fsp->fsp_flags.initial_delete_on_close = true; } /* @@ -4536,7 +4536,7 @@ static NTSTATUS open_directory(connection_struct *conn, if (NT_STATUS_IS_OK(status)) { /* Note that here we set the *initial* delete on close flag, not the regular one. The magic gets handled in close. */ - fsp->initial_delete_on_close = True; + fsp->fsp_flags.initial_delete_on_close = true; } } diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index a2d621db1c3..32b3e5dd4ce 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -7871,7 +7871,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, if (NT_STATUS_IS_OK(status)) { /* Note that here we set the *initial* delete on close flag, * not the regular one. The magic gets handled in close. */ - fsp->initial_delete_on_close = True; + fsp->fsp_flags.initial_delete_on_close = true; } } TALLOC_FREE(lck); diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c index 9e3c3daf2e0..d8d0b415af7 100644 --- a/source3/smbd/smb2_close.c +++ b/source3/smbd/smb2_close.c @@ -240,7 +240,7 @@ static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req, } if ((in_flags & SMB2_CLOSE_FLAGS_FULL_INFORMATION) && - (fsp->initial_delete_on_close || + (fsp->fsp_flags.initial_delete_on_close || fsp->delete_on_close)) { /* -- 2.47.3