]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: restrict pure R leases on directories on CA shares
authorRalph Boehme <slow@samba.org>
Fri, 28 Nov 2025 11:12:52 +0000 (12:12 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:36 +0000 (10:18 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/smbd/open.c

index cac28775030729436f194b1b199a61c61c028342..8ba54553aad1ca81fd91c84744e2e01e9b182c5d 100644 (file)
@@ -2683,6 +2683,17 @@ grant:
                 * ignores the SMB2_LEASE_WRITE bit.
                 */
                granted &= ~SMB2_LEASE_WRITE;
+               if (fsp->conn->tcon->capabilities &
+                   SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY)
+               {
+                       /*
+                        * Windows doesn't grant "pure" R leases in SO mode on
+                        * directories, we apply this restriction in CA mode. As
+                        * we also don't grant H leases in CA mode, set granted
+                        * to 0.
+                        */
+                       granted = 0;
+               }
        }
 
        if (oplock_request == LEASE_OPLOCK) {