]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: avoid granting "H"-only lease
authorRalph Boehme <slow@samba.org>
Mon, 2 Jun 2025 10:07:26 +0000 (12:07 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 15 Aug 2025 15:46:35 +0000 (15:46 +0000)
If an "RH" lease was requested and due to existing brl-lock we do not grant
an "R" lease, we end up granting an "H"-only lease which is not a valid lease
state.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/open.c

index e50b6b68fab9a163f68a3e5c7c188bd6b3c56abc..1bf8262d4e714db5e3df89ea5deb7132f6b403c8 100644 (file)
@@ -2500,7 +2500,7 @@ grant:
        if (lp_locking(fsp->conn->params) && file_has_brlocks(fsp)) {
                DBG_DEBUG("file %s has byte range locks\n",
                          fsp_str_dbg(fsp));
-               granted &= ~SMB2_LEASE_READ;
+               granted &= ~(SMB2_LEASE_READ | SMB2_LEASE_HANDLE);
        }
 
        if (state.disallow_write_lease) {