]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: add is_lease_stat_open()
authorRalph Boehme <slow@samba.org>
Thu, 5 Mar 2020 14:14:21 +0000 (15:14 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 30 Apr 2020 19:32:45 +0000 (19:32 +0000)
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 <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c
source3/smbd/proto.h

index b5160300e48f5d19e59e5686eac92a2a23f56062..3cd8f156ab61f153bc3166829b09c614d7e7f2b8 100644 (file)
@@ -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;
 };
index 5713620ab6ef3478fc6ad7978a3679550492b02f..dadccf189bb1d7e75c995a6ec47eb558455d9144 100644 (file)
@@ -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,