]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: only increment lease epoch if a lease was granted
authorRalph Boehme <slow@samba.org>
Tue, 23 Sep 2025 12:14:22 +0000 (14:14 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 10 Oct 2025 17:02:26 +0000 (17:02 +0000)
From MS-SMB2 3.3.5.9.11 "Handling the SMB2_CREATE_REQUEST_LEASE_V2 Create
Context":

  If the object store succeeds this request, Lease.LeaseState MUST be set to the
  new caching state.  The server MUST increment Lease.Epoch by 1.

try_lease_upgrade() already has the same logic when checking for a possible
upgrade of an exisiting lease.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Oct 10 17:02:26 UTC 2025 on atb-devel-224

selftest/knownfail.d/samba3.smb2.lease [deleted file]
source3/smbd/open.c

diff --git a/selftest/knownfail.d/samba3.smb2.lease b/selftest/knownfail.d/samba3.smb2.lease
deleted file mode 100644 (file)
index d1bc420..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.smb2.lease.lease-epoch\(fileserver\)
index 91abe9a5c24af8374525862234603a0ac8c6e79f..a26cf653612ac04c0ee0c382999efc41b03e5b27 100644 (file)
@@ -2045,7 +2045,10 @@ static NTSTATUS grant_new_fsp_lease(struct files_struct *fsp,
        fsp->lease->lease.parent_lease_key = lease->parent_lease_key;
        fsp->lease->lease.lease_flags = lease->lease_flags;
        fsp->lease->lease.lease_state = granted;
-       fsp->lease->lease.lease_epoch = lease->lease_epoch + 1;
+       fsp->lease->lease.lease_epoch = lease->lease_epoch;
+       if (granted != 0) {
+               fsp->lease->lease.lease_epoch++;
+       }
 
        status = leases_db_add(client_guid,
                               &lease->lease_key,