From 8a66b3ffbd52b5b8e482dccb0b5a296c00c784cb Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Mon, 29 Jan 2024 14:32:28 +1000 Subject: [PATCH] Fix up compound request session and tree ids Change to not set the SessionId and TreeId in the SMB headers of related compound requests as it is not in the spec. The spec only states the FileId used in the first create should be set to all bits and not these other two fields. --- CHANGELOG.md | 1 + src/smbprotocol/connection.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ff1bfb..0940f9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Stop using `datetime.datetime.utcfromtimestamp()` as it has been deprecated * Added default timeout for disconnect operations for 60 seconds to ensure the process doesn't hang forever when closing a broken connection * `smbprotocol.connection.Connection.disconnect()` now waits (with a timeout) for the message processing threads to be stopped before returning. +* Do not set the SMB SessionId and TreeId in the headers to `0xFFFFFFFF` for related compound requests ## 1.12.0 - 2023-11-09 diff --git a/src/smbprotocol/connection.py b/src/smbprotocol/connection.py index 423bbd1..2c05b9d 100644 --- a/src/smbprotocol/connection.py +++ b/src/smbprotocol/connection.py @@ -1256,8 +1256,6 @@ def _send( header["flags"].set_flag(Smb2Flags.SMB2_FLAGS_DFS_OPERATIONS) if i != 0 and related: - header["session_id"] = b"\xff" * 8 - header["tree_id"] = b"\xff" * 4 header["flags"].set_flag(Smb2Flags.SMB2_FLAGS_RELATED_OPERATIONS) if force_signature or (session and session.signing_required and session.signing_key):