]> 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)
committerJule Anger <janger@samba.org>
Thu, 5 Jun 2025 10:57:15 +0000 (10:57 +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>
(cherry picked from commit 5d4565c1f974b75a1c080f4503613201ecaf7001)

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 9c89bcc96f57666325818bea8b22dde6fbcfd57d..d227e639e1cac0d503a41382e83317dbc0f9cfc9 100644 (file)
@@ -1247,6 +1247,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 d68c0bd9e6c2a8a509dea1cf92883b3b352ce735..4195adc3804ea6b0cdc4e1f1b88084cf37c92fd4 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 16a4c70da2c056ac0a276e35b77959385a20df97..4b7a6c0363c19fbdb4301fb0b561d1d9fd5576c5 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 c074bb851de0c9f47e27504f60bfb7e20ecaee66..3d4f0967570f5122632b630901984b501a403e1b 100644 (file)
@@ -2618,6 +2618,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)) {