From: Ralph Boehme Date: Fri, 3 Apr 2020 05:48:08 +0000 (+0200) Subject: smbd: move files_struct.delete_on_close to a bitfield X-Git-Tag: ldb-2.2.0~987 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=930b7525a669b96231c2bcd72bccf7e4aa4601ed;p=thirdparty%2Fsamba.git smbd: move files_struct.delete_on_close to a bitfield Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/include/vfs.h b/source3/include/vfs.h index adb64c61e70..6f7670eee14 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -369,6 +369,7 @@ typedef struct files_struct { bool is_directory : 1; bool aio_write_behind : 1; bool initial_delete_on_close : 1; + bool delete_on_close : 1; } fsp_flags; struct tevent_timer *update_write_time_event; @@ -389,7 +390,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 delete_on_close; uint64_t posix_flags; bool is_sparse; bool backup_intent; /* Handle was successfully opened with backup intent diff --git a/source3/locking/locking.c b/source3/locking/locking.c index c2ccd669c71..f5426391c21 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -941,7 +941,7 @@ bool set_delete_on_close(files_struct *fsp, bool delete_on_close, TALLOC_FREE(lck); - fsp->delete_on_close = delete_on_close; + fsp->fsp_flags.delete_on_close = delete_on_close; return True; } diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c index 35dc82ee11d..7bed255d390 100644 --- a/source3/modules/vfs_acl_common.c +++ b/source3/modules/vfs_acl_common.c @@ -1137,7 +1137,8 @@ static int acl_common_remove_object(vfs_handle_struct *handle, for (fsp = file_find_di_first(conn->sconn, id); fsp; fsp = file_find_di_next(fsp)) { if (fsp->access_mask & DELETE_ACCESS && - fsp->delete_on_close) { + fsp->fsp_flags.delete_on_close) + { /* We did open this for delete, * allow the delete as root. */ diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 5207a6b67c4..7ad50aa325a 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -349,7 +349,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, become_user_without_service(conn, fsp->vuid); became_user = True; } - fsp->delete_on_close = true; + fsp->fsp_flags.delete_on_close = true; set_delete_on_close_lck(fsp, lck, get_current_nttok(conn), get_current_utok(conn)); @@ -499,7 +499,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, * the delete on close flag. JRA. */ - fsp->delete_on_close = false; + fsp->fsp_flags.delete_on_close = false; reset_delete_on_close_lck(fsp, lck); done: @@ -1142,7 +1142,7 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp, set_delete_on_close_lck(fsp, lck, get_current_nttok(fsp->conn), get_current_utok(fsp->conn)); - fsp->delete_on_close = true; + fsp->fsp_flags.delete_on_close = true; if (became_user) { unbecome_user_without_service(); } diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c index f557c51aa69..bed48ef0447 100644 --- a/source3/smbd/durable.c +++ b/source3/smbd/durable.c @@ -183,7 +183,7 @@ NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp, if (fsp->fsp_flags.initial_delete_on_close) { return NT_STATUS_NOT_SUPPORTED; } - if (fsp->delete_on_close) { + if (fsp->fsp_flags.delete_on_close) { return NT_STATUS_NOT_SUPPORTED; } diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c index d8d0b415af7..2f9a73cb69f 100644 --- a/source3/smbd/smb2_close.c +++ b/source3/smbd/smb2_close.c @@ -241,7 +241,7 @@ static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req, if ((in_flags & SMB2_CLOSE_FLAGS_FULL_INFORMATION) && (fsp->fsp_flags.initial_delete_on_close || - fsp->delete_on_close)) + fsp->fsp_flags.delete_on_close)) { /* * We might be deleting the file. Ensure we