Skip to content

Add unchecked DFS tree return method to support DFS referral queries via IPC$ shares #161

@davelil4

Description

@davelil4

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:

  1. Direct connect connection to \\domain.com\share fails (not a server)
  2. Connect to IPC$ on a domain controller IP
  3. Query DFS referrals via `dfs_get_referrals(r"\domain.com\share")
  4. Connect to the resolved target

Without as_dfs_tree_unchecked() this fails because of the check for the DFS flags.

Alternatives

  1. Modifying the IPC share flags which is not a good idea
  2. Deeper api changes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions