Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMB Server fix filename offsets #1831

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

jborean93
Copy link
Contributor

Correctly set the NextEntryOffset for the SMBFindFileNamesInfo results when querying the names of files. The current logic does not set this value so will be set to 0 making the client believe there are no more entries in the result if going by the MS-SMB2 logic.

The docs for FileNamesInformation state that NextEntryOffset should be

A 32-bit unsigned integer that contains the byte offset from the beginning of this entry, at which the next FILE_NAMES_INFORMATION entry is located, if multiple entries are present in a buffer. This member MUST be zero if no other entries follow this one. An implementation MUST use this value to determine the location of the next entry (if multiple entries are present in a buffer)

Currently you can see that while the reponse buffer contains all the entires, becaue NextEntryOffset is 0, consumers of this buffer only see the first entry when going by the MS-FSCC logic (0 is last entry)

image

After this change you can see the payload is correctly dissected by Wireshark

image

Correctly set the NextEntryOffset for the SMBFindFileNamesInfo results
when querying the names of files. The current logic does not set this
value so will be set to 0 making the client believe there are no more
entries in the result if going by the MS-SMB2 logic.
@gabrielg5
Copy link
Collaborator

Hi @jborean93, thanks for this fix!

I've been checking and testing it and all good. Merging...

These coming days, I'll be checking the other PRs you've created. Thanks! 🫶

@gabrielg5 gabrielg5 merged commit af91d61 into fortra:master Dec 12, 2024
8 checks passed
@gabrielg5 gabrielg5 added the bug Unexpected problem or unintended behavior label Dec 12, 2024
@jborean93 jborean93 deleted the smb-filename-query branch December 12, 2024 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected problem or unintended behavior in review This issue or pull request is being analyzed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants