From: Ralph Boehme Date: Thu, 5 Mar 2020 14:14:21 +0000 (+0100) Subject: smbd: add is_lease_stat_open() X-Git-Tag: ldb-2.2.0~788 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9b0a31af128f9ec2551b6cca7200903d8e24a6f4;p=thirdparty%2Fsamba.git smbd: add is_lease_stat_open() This adds a leases specific stat opens access mask check function. See also: https://lists.samba.org/archive/cifs-protocol/2020-March/003409.html BUG: https://bugzilla.samba.org/show_bug.cgi?id=14357 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index b5160300e48..3cd8f156ab6 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1577,6 +1577,21 @@ bool is_oplock_stat_open(uint32_t access_mask) ((access_mask & ~stat_open_bits) == 0)); } +/** + * Allowed access mask for stat opens relevant to leases + **/ +bool is_lease_stat_open(uint32_t access_mask) +{ + const uint32_t stat_open_bits = + (SYNCHRONIZE_ACCESS| + FILE_READ_ATTRIBUTES| + FILE_WRITE_ATTRIBUTES| + READ_CONTROL_ACCESS); + + return (((access_mask & stat_open_bits) != 0) && + ((access_mask & ~stat_open_bits) == 0)); +} + struct has_delete_on_close_state { bool ret; }; diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 5713620ab6e..dadccf189bb 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -714,6 +714,7 @@ void change_file_owner_to_parent(connection_struct *conn, struct smb_filename *inherit_from_dir, files_struct *fsp); bool is_oplock_stat_open(uint32_t access_mask); +bool is_lease_stat_open(uint32_t access_mask); NTSTATUS send_break_message(struct messaging_context *msg_ctx, const struct file_id *id, const struct share_mode_entry *exclusive,