Skip to content

Commit 6d2cf01

Browse files
slowfranklinJule Anger
authored andcommitted
smbd: only increment lease epoch if a lease was granted
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 <[email protected]> Reviewed-by: Volker Lendecke <[email protected]> Autobuild-User(master): Volker Lendecke <[email protected]> Autobuild-Date(master): Fri Oct 10 17:02:26 UTC 2025 on atb-devel-224 (cherry picked from commit 9f45eae) Autobuild-User(v4-23-test): Jule Anger <[email protected]> Autobuild-Date(v4-23-test): Wed Oct 15 15:10:19 UTC 2025 on atb-devel-224
1 parent 1757b5a commit 6d2cf01

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

selftest/knownfail.d/samba3.smb2.lease

Lines changed: 0 additions & 1 deletion
This file was deleted.

source3/smbd/open.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,10 @@ static NTSTATUS grant_new_fsp_lease(struct files_struct *fsp,
20562056
fsp->lease->lease.parent_lease_key = lease->parent_lease_key;
20572057
fsp->lease->lease.lease_flags = lease->lease_flags;
20582058
fsp->lease->lease.lease_state = granted;
2059-
fsp->lease->lease.lease_epoch = lease->lease_epoch + 1;
2059+
fsp->lease->lease.lease_epoch = lease->lease_epoch;
2060+
if (granted != 0) {
2061+
fsp->lease->lease.lease_epoch++;
2062+
}
20602063

20612064
status = leases_db_add(client_guid,
20622065
&lease->lease_key,

0 commit comments

Comments
 (0)