]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/smb: only copy the parent lease key if SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET...
authorRalph Boehme <slow@samba.org>
Thu, 24 Oct 2024 17:35:00 +0000 (19:35 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 5 Nov 2024 14:39:31 +0000 (14:39 +0000)
MS-SMB2 3.3.5.9.11 Handling the SMB2_CREATE_REQUEST_LEASE_V2 Create Context:

  If the SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET bit is set in the Flags field of
  the request, Lease.ParentLeaseKey MUST be set to the ParentLeaseKey of the
  request.

Found by MS-SMB2-Prototocol-Testsuite test "Compare_Zero_LeaseFlag_ParentLeaseKey".

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
libcli/smb/smb2_lease.c
selftest/knownfail.d/samba3.smb2.lease [deleted file]

index 442bdc600216ce58bbe71cb77e0d3ac03a808437..d28477b1911901a1870c5e9881d3e7c016ad439a 100644 (file)
@@ -52,9 +52,11 @@ ssize_t smb2_lease_pull(const uint8_t *buf, size_t len,
        case 1:
                break;
        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;
+               if (lease->lease_flags & SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET) {
+                       memcpy(&lease->parent_lease_key, buf+32, 16);
+               }
                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 (file)
index c3084dc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.smb2.lease.v2_flags_parentkey\(fileserver\)