]> 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)
committerJule Anger <janger@samba.org>
Wed, 15 Oct 2025 15:10:19 +0000 (15:10 +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

(cherry picked from commit 9f45eae2928bd2cb46fc827a348531acb471a549)

Autobuild-User(v4-23-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-23-test): Wed Oct 15 15:10:19 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 e50b6b68fab9a163f68a3e5c7c188bd6b3c56abc..f2cbf7d6bf69053c64909ee8db0370ce1e47a164 100644 (file)
@@ -2056,7 +2056,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,