Problem
When querying DFS referrals via an IPC$ share (common pattern for resolving domain-based DFS namespaces), as_dfs_tree() in fails with "Tree is not a DFS tree" because technically IPC shares do not have the proper flags set (dfs_root or dfs).
This is a standard approach used by other smb libraries (like pythons smbprotocol which tries to connect to \\server\IPC$ and send FSCTL_DFS_GET_REFERRALS to resolve DFS paths. The server accepts these requests on IPC$ even though the share is not a DFS root.
Solution
Add as_dfs_tree_unchecked() method to Tree that just returns a DfsRootTreeRef without actually verifying the share flags:
pub fn as_dfs_tree_unchecked(&self) -> DfsRootTreeRef<'_> {
DfsRootTreeRef::new(self);
}
Use Case
Resolving domain-based DFS paths like \\domain.com\share\path:
- Direct connect connection to
\\domain.com\share fails (not a server)
- Connect to IPC$ on a domain controller IP
- Query DFS referrals via `dfs_get_referrals(r"\domain.com\share")
- Connect to the resolved target
Without as_dfs_tree_unchecked() this fails because of the check for the DFS flags.
Alternatives
- Modifying the IPC share flags which is not a good idea
- Deeper api changes
Problem
When querying DFS referrals via an IPC$ share (common pattern for resolving domain-based DFS namespaces),
as_dfs_tree()in fails with "Tree is not a DFS tree" because technically IPC shares do not have the proper flags set (dfs_rootordfs).This is a standard approach used by other smb libraries (like pythons
smbprotocolwhich tries to connect to\\server\IPC$and sendFSCTL_DFS_GET_REFERRALSto resolve DFS paths. The server accepts these requests on IPC$ even though the share is not a DFS root.Solution
Add
as_dfs_tree_unchecked()method toTreethat just returns aDfsRootTreeRefwithout actually verifying the share flags:Use Case
Resolving domain-based DFS paths like
\\domain.com\share\path:\\domain.com\sharefails (not a server)Without
as_dfs_tree_unchecked()this fails because of the check for the DFS flags.Alternatives