Apart from #354, I have also other issue to report or maybe this is a feature request? Not sure yet :)
Environment
- SMBLibrary 1.5.7.1
- Client: .NET 9 on Linux (
mcr.microsoft.com/dotnet/aspnet:9.0-alpine-extra container, working DNS servers and DNS search domain configured)
- Server: Active Directory domain with a domain-based DFS namespace
- Transport:
SMBTransportType.DirectTCPTransport
- Authentication: NTLM, domain account
Names below are example values:
| Element |
Example value |
| AD domain / namespace name |
example.local |
| Namespace share |
Namespace |
| Namespace server (physical) |
nsserver.example.local |
| DFS link (first path segment) |
Link |
| Referral target server / share |
FS01 / Data$ |
Summary
In one sentence: a domain-based DFS namespace cannot be connected at all, because SMBLibrary sends TreeConnect directly instead of first resolving the DFS root referral.
Why:
\\example.local\Namespace is not a real share on any host. The first path component is the AD domain name, and the namespace exists only as a DFS root referral served by domain controllers.
- The Windows client therefore asks a DC for a root referral before the tree connect, learns which physical servers host the namespace, connects to one of them and tree connects there.
- SMBLibrary skips that step:
SMB2Client.TreeConnect("Namespace") goes straight to whatever host Connect(...) was called with, and the server answers STATUS_BAD_NETWORK_NAME.
- There is no public API and no internal code path performing the root referral, so the failure occurs before
SMB2DfsFileStore could even be created.
Steps to reproduce
- Create a domain-based DFS namespace
\\example.local\Namespace hosted on nsserver.example.local,
with a link Link pointing to \\FS01\Data$.
- From a client with working DNS for
example.local:
var client = new SMB2Client();
var connected = client.Connect("example.local", SMBTransportType.DirectTCPTransport); // true
var login = client.Login("EXAMPLE", "svc_account", "***"); // STATUS_SUCCESS
var store = client.TreeConnect("Namespace", out var status);
Console.WriteLine(status); // STATUS_BAD_NETWORK_NAME, store == null
Actual result
Connect -> true
Login -> STATUS_SUCCESS
TreeConnect("Namespace") -> STATUS_BAD_NETWORK_NAME
Expected result
Either
TreeConnect transparently resolves the DFS root referral for \\example.local\Namespace (ask a DC / the connected host for a DFS_REFERRAL of the root path, pick a namespace server, connect there and tree connect to the namespace share), or
- a documented public API is exposed so the caller can perform the root referral itself and connect to the resolved namespace server.
Notes
Connecting to the namespace server's own host name (Connect("nsserver.example.local") + TreeConnect("Namespace")) makes the tree connect succeed, but that is a workaround: it pins the client to one specific namespace server and loses the high availability the domain-based namespace exists for.
Impact
Domain-based DFS namespaces - the standard, highly available deployment form - cannot be accessed at all. Callers must hard-code a specific namespace server, which loses high availability and defeats the purpose of a domain-based namespace.
Apart from #354, I have also other issue to report or maybe this is a feature request? Not sure yet :)
Environment
mcr.microsoft.com/dotnet/aspnet:9.0-alpine-extracontainer, working DNS servers and DNS search domain configured)SMBTransportType.DirectTCPTransportNames below are example values:
example.localNamespacensserver.example.localLinkFS01/Data$Summary
In one sentence: a domain-based DFS namespace cannot be connected at all, because SMBLibrary sends
TreeConnectdirectly instead of first resolving the DFS root referral.Why:
\\example.local\Namespaceis not a real share on any host. The first path component is the AD domain name, and the namespace exists only as a DFS root referral served by domain controllers.SMB2Client.TreeConnect("Namespace")goes straight to whatever hostConnect(...)was called with, and the server answersSTATUS_BAD_NETWORK_NAME.SMB2DfsFileStorecould even be created.Steps to reproduce
\\example.local\Namespacehosted onnsserver.example.local,with a link
Linkpointing to\\FS01\Data$.example.local:Actual result
Expected result
Either
TreeConnecttransparently resolves the DFS root referral for\\example.local\Namespace(ask a DC / the connected host for aDFS_REFERRALof the root path, pick a namespace server, connect there and tree connect to the namespace share), orNotes
Connecting to the namespace server's own host name (
Connect("nsserver.example.local")+TreeConnect("Namespace")) makes the tree connect succeed, but that is a workaround: it pins the client to one specific namespace server and loses the high availability the domain-based namespace exists for.Impact
Domain-based DFS namespaces - the standard, highly available deployment form - cannot be accessed at all. Callers must hard-code a specific namespace server, which loses high availability and defeats the purpose of a domain-based namespace.