Skip to content

Update from the original library - #12

Open
legendarymember wants to merge 251 commits into
Dualog:masterfrom
TalAloni:master
Open

legendarymember wants to merge 251 commits into
Dualog:masterfrom
TalAloni:master

Conversation

@legendarymember

Copy link
Copy Markdown

No description provided.

TalAloni and others added 30 commits November 19, 2021 12:44
Ensure the `MsvAvTargetName` AV Pair is provided with the NTLM v2
authentication message. This is set to the Service Principal Name (SPN)
of the server being connected to.
Add DfsReferralHelper and DfsPath under SMBLibrary/Client/DFS/ as the
transport layer building on the already-merged DFS protocol types.

DfsReferralHelper sends FSCTL_DFS_GET_REFERRALS via DeviceIOControl
with the sentinel FileId (MS-SMB2 §2.2.31) and returns a parsed
ResponseGetDfsReferral. DfsPath parses UNC paths into components for
referral request construction and future path replacement.

These are the building blocks for SMB2DfsFileStore.
@TalAloni
TalAloni force-pushed the master branch 2 times, most recently from 86f584f to 0aa44da Compare April 18, 2026 22:00
TalAloni and others added 5 commits September 5, 2026 17:51
A domain-based namespace is addressed as 'domain\namespace', where the first
component names the domain rather than a server. No host serves a share by that
name, so a tree connect sent directly to it fails with STATUS_BAD_NETWORK_NAME.

A DFS referral is now requested for the share before the tree connect is sent,
and the tree connect goes to the server the referral names. A referral answered
with STATUS_NOT_FOUND identifies an ordinary share, which is tree connected
directly, so no request is sent that is expected to fail. This is the order a
Windows client uses, confirmed against a capture. An SMB2Client constructor
argument sets whether this happens, so it can be turned off without changing
call sites.

Referral targets are restricted to root targets per MS-DFSC 2.2.4.3. Reaching
one is taken as identifying the namespace: [MS-SMB2] 3.3.5.7 leaves DFS_ROOT
optional in the tree connect response, so requiring it would leave a namespace
unreachable on a server that omits it. A referral naming the server already
connected to reuses that connection rather than opening a second one, and any
failure - IPC$ unreachable, referral refused, no usable target - falls through
to the direct tree connect.

The store returned for a namespace hosted on another server owns the connection
opened to reach it and releases it on Disconnect. Releasing a connection is now
SMB2Client.LogoffAndDisconnect, which disconnects in a finally: a logoff can
fail for reasons other than a lost connection - TrySendCommand throws when the
credits are exhausted - and the socket still has to be closed.
…returned by recent macOS versions when listing shares
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.