]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: add access_mask to delay_for_handle_lease_break_send()
authorRalph Boehme <slow@samba.org>
Fri, 23 May 2025 15:06:50 +0000 (17:06 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 28 May 2025 15:06:29 +0000 (15:06 +0000)
No change in behaviour, existing caller all pass SEC_RIGHTS_DIR_ALL. Prepares
for selectively breaking only H-leases if the access_mask of the corresponding
open contains DELETE_ACCESS.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15861

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Bjoern Jacke <bjacke@samba.org>
source3/smbd/proto.h
source3/smbd/smb2_close.c
source3/smbd/smb2_oplock.c
source3/smbd/smb2_setinfo.c
source3/smbd/smbXsrv_session.c

index 1befef66ede7d8e41a405afdd2b960079c0673bd..08506dec7432a22793b73ffed9db6dbf90dbc3f0 100644 (file)
@@ -1250,6 +1250,7 @@ struct tevent_req *delay_for_handle_lease_break_send(
        struct tevent_context *ev,
        struct timeval timeout,
        struct files_struct *fsp,
+       uint32_t access_mask,
        bool recursive,
        struct share_mode_lock **lck);
 
index d37b6cec4c8c4559e3537221ec249d56582e7c12..8bf51a5f48280dc53cc4995bc60d28de5ce43ca9 100644 (file)
@@ -369,6 +369,7 @@ static struct tevent_req *smbd_smb2_close_send(TALLOC_CTX *mem_ctx,
                                                           ev,
                                                           timeout,
                                                           in_fsp,
+                                                          SEC_RIGHTS_DIR_ALL,
                                                           false,
                                                           &lck);
                if (tevent_req_nomem(subreq, req)) {
index 4e877c147caf16110ff07057c7b2b6d026fae1f4..dcc0f13870a93817cff3d141021ed550cc8e0e8c 100644 (file)
@@ -1516,6 +1516,7 @@ struct delay_for_handle_lease_break_state {
        TALLOC_CTX *mem_ctx;
        struct tevent_context *ev;
        struct timeval timeout;
+       uint32_t access_mask;
        bool recursive;
        bool recursive_h_leases_break;
        struct files_struct *fsp;
@@ -1546,6 +1547,7 @@ struct tevent_req *delay_for_handle_lease_break_send(
        struct tevent_context *ev,
        struct timeval timeout,
        struct files_struct *fsp,
+       uint32_t access_mask,
        bool recursive,
        struct share_mode_lock **lck)
 {
@@ -1564,6 +1566,7 @@ struct tevent_req *delay_for_handle_lease_break_send(
                .mem_ctx = mem_ctx,
                .ev = ev,
                .timeout = timeout,
+               .access_mask = access_mask,
                .recursive = recursive,
                .recursive_h_leases_break = recursive,
                .fsp = fsp,
@@ -1604,6 +1607,10 @@ static bool delay_for_handle_lease_break_fn(struct share_mode_entry *e,
                }
        }
 
+       if ((state->access_mask & e->access_mask) == 0) {
+               return false;
+       }
+
        lease_type = get_lease_type(e, fsp->file_id);
        if ((lease_type & SMB2_LEASE_HANDLE) == 0) {
                return false;
index 91280a52c07748106e55279499429f58a4a268da..86cd0eac0cac16d178030d2e4706d0409a450a32 100644 (file)
@@ -489,6 +489,7 @@ static void smbd_smb2_setinfo_lease_break_fsp_check(struct tevent_req *req)
                                                   state->ev,
                                                   timeout,
                                                   fsp,
+                                                  SEC_RIGHTS_DIR_ALL,
                                                   rename,
                                                   &state->lck);
        if (tevent_req_nomem(subreq, req)) {
@@ -656,6 +657,7 @@ static void smbd_smb2_setinfo_rename_dst_check(struct tevent_req *req)
                                                   state->ev,
                                                   timeout,
                                                   state->dstfsp,
+                                                  SEC_RIGHTS_DIR_ALL,
                                                   false,
                                                   &state->lck);
        if (subreq == NULL) {
index a4fa61821c82f1b8f623f81e166a440974dd31f0..a268c3ff102f8c73a567d2aa06be65ef50c5a54b 100644 (file)
@@ -2619,6 +2619,7 @@ static struct files_struct *smbXsrv_wait_for_handle_lease_break_fn(
                                                   state->ev,
                                                   timeout,
                                                   fsp,
+                                                  SEC_RIGHTS_DIR_ALL,
                                                   false,
                                                   &lck);
        if (tevent_req_nomem(subreq, state->req)) {