smb3-seal: byte-swap SessionId for the wire in smb3_encrypt_pdu() - #478
Merged
sahlberg merged 1 commit intoAug 28, 2026
Merged
Conversation
The SMB2_TRANSFORM_HEADER's OriginalMessageSize and EncryptionAlgorithm fields are explicitly converted with htole32/ htole16 before being written, but SessionId was copied via a raw memcpy of the host-order value. A no-op bug on little-endian hosts, where host order already equals wire order; on big-endian (PPC) it produces a byte-reversed SessionId in every encrypted PDU, which a server has no reason to accept -- confirmed on a PPC Tiger iBook via packet capture, where smb2_set_seal(ctx, 1) got rejected identically by both macOS's and Windows 11's standard SMB3 sharing right after the first TRANSFORM_HEADER-wrapped PDU. Fixes sahlberg#477.
watermark-hd
added a commit
to watermark-hd/ppc-mac-modernization
that referenced
this pull request
Aug 28, 2026
sahlberg confirmed the bug on Issue #477 and asked for a PR with a different style (a direct pointer-cast assignment instead of a scoped local variable + memcpy). Re-verified on real hardware with the new form against both macOS's and Windows 11's SMB3 sharing. Sent as sahlberg/libsmb2#478, and updated the PPCPorts patch (#236) to match.
watermark-hd
added a commit
to watermark-hd/powerpc-ports
that referenced
this pull request
Aug 28, 2026
Owner
|
Awesome, thanks. Merged! I will set up a Linux PPC environment under qemu. I should be able to reproduce the issue there and then I can try to wire it into my test environmet. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #477.
Per your feedback there -- switched from the scoped-variable version to a direct pointer-cast assignment:
Re-tested on the same PPC hardware (Tiger iBook G4) with this exact form:
smb2_set_seal(ctx, 1)connects successfully against both macOS's and Windows 11's standard SMB3 sharing.