Skip to content

feat(auth)!: add ResetSecurityContext to IAuthenticationClient for DFS target auth#3

Open
jahales wants to merge 1 commit into
masterfrom
3-smb2-dfs-auth-infrastructure
Open

feat(auth)!: add ResetSecurityContext to IAuthenticationClient for DFS target auth#3
jahales wants to merge 1 commit into
masterfrom
3-smb2-dfs-auth-infrastructure

Conversation

@jahales
Copy link
Copy Markdown
Owner

@jahales jahales commented Apr 18, 2026

Summary

Add ResetSecurityContext(string host) to IAuthenticationClient and implement it in NTLMAuthenticationClient. This enables reusing a single auth-client instance when connecting to DFS target servers (needed by the upcoming SMB2DfsFileStore).

Also retain the IAuthenticationClient reference in SMB2Client after successful login (cleared on logoff/disconnect) and expose a Transport property for target client construction.

This is PR 1 of 2 for DFS file store support. PR 2 will add SMB2DfsFileStore and the TreeConnect() DFS root detection, building on this foundation.

Changes

File Change
IAuthenticationClient.cs Add ResetSecurityContext(string host) method (+XML doc)
NTLMAuthenticationClient.cs Implement ResetSecurityContext: update SPN to cifs/{host}, clear handshake state
SMB2Client.cs Retain m_authenticationClient after Login(), clear on Logoff()/Disconnect(), add Transport property

Breaking Change

IAuthenticationClient now requires a ResetSecurityContext(string host) method. Existing implementations must add this method.

This is the only public interface change for the entire DFS feature — Tal proposed this approach in the PR TalAloni#326 discussion as a worthy tradeoff for integrated DFS support that works with Kerberos.

Type of Change

  • Breaking change (interface addition)
  • New feature (DFS auth infrastructure)

Testing

  • Build: 0 errors, 0 new warnings (all 3 target frameworks)
  • Tests: 56 pass, 1 pre-existing failure (NTDirectoryFileSystemTests.TestCancel — requires local filesystem)
  • Zero behavioral change for existing callers — m_authenticationClient is stored but not yet used

Context

…S target auth

Add ResetSecurityContext(string host) to IAuthenticationClient interface,
enabling auth-client reuse when connecting to DFS target servers.

- IAuthenticationClient: add ResetSecurityContext(string host) method
- NTLMAuthenticationClient: implement reset (update SPN, clear handshake state)
- SMB2Client: retain IAuthenticationClient after Login, clear on Logoff/Disconnect
- SMB2Client: expose Transport property for target client construction

BREAKING CHANGE: IAuthenticationClient now requires a ResetSecurityContext(string host) method.
Existing implementations must add this method.
@jahales jahales force-pushed the 3-smb2-dfs-auth-infrastructure branch from 0c1c280 to 4c64941 Compare April 18, 2026 20:18
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.

1 participant