From 52d8af2f423d9c8823970a9de1137a6c3ad3eb50 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 22 Oct 2024 15:05:58 +0200 Subject: [PATCH] libcli/smb: only allow SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET in lease_flag MS-SMB2 3.3.5.9.11 Handling the SMB2_CREATE_REQUEST_LEASE_V2 Create Context: The server MUST attempt to locate a Lease by performing a lookup in the LeaseTable.LeaseList using the LeaseKey ... If no lease is found, one MUST be allocated with the following values set: ... * Lease.Breaking is set to FALSE. ... Ensures we ignore SMB2_LEASE_FLAG_BREAK_IN_PROGRESS. Found by MS-SMB2-Prototocol-Testsuite "BreakReadLeaseV2TestCaseS0". Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher --- libcli/smb/smb2_lease.c | 1 + selftest/knownfail.d/samba3.smb2.lease | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 selftest/knownfail.d/samba3.smb2.lease diff --git a/libcli/smb/smb2_lease.c b/libcli/smb/smb2_lease.c index 630fd3943cc..442bdc60021 100644 --- a/libcli/smb/smb2_lease.c +++ b/libcli/smb/smb2_lease.c @@ -54,6 +54,7 @@ ssize_t smb2_lease_pull(const uint8_t *buf, size_t len, case 2: memcpy(&lease->parent_lease_key, buf+32, 16); lease->lease_flags = IVAL(buf, 20); + lease->lease_flags &= SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET; lease->lease_duration = BVAL(buf, 24); lease->lease_epoch = SVAL(buf, 48); break; diff --git a/selftest/knownfail.d/samba3.smb2.lease b/selftest/knownfail.d/samba3.smb2.lease deleted file mode 100644 index c29d81adc7c..00000000000 --- a/selftest/knownfail.d/samba3.smb2.lease +++ /dev/null @@ -1 +0,0 @@ -^samba3.smb2.lease.v2_flags_breaking\(fileserver\) -- 2.11.4.GIT