diff options
author | Paulo Alcantara <pc@manguebit.com> | 2025-01-03 16:58:12 -0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2025-01-19 19:34:00 -0600 |
commit | ad46faff1afcc8db72f9954a6ea2296d31259217 (patch) | |
tree | 7938327a62e8c35757874d52a965e84029f71c26 /fs/smb/client/connect.c | |
parent | 0e8ae9b953bc2c12aebd21e1e552e5deb1a0ff1e (diff) |
smb: client: fix DFS mount against old servers with NTLMSSP
Old Windows servers will return not fully qualified DFS targets by
default as specified in
MS-DFSC 3.2.5.5 Receiving a Root Referral Request or Link Referral
Request
| Servers SHOULD<30> return fully qualified DNS host names of
| targets in responses to root referral requests and link referral
| requests.
| ...
| <30> Section 3.2.5.5: By default, Windows Server 2003, Windows
| Server 2008, Windows Server 2008 R2, Windows Server 2012, and
| Windows Server 2012 R2 return DNS host names that are not fully
| qualified for targets.
Fix this by converting all NetBIOS host names from DFS targets to
FQDNs and try resolving them first if DNS domain name was provided in
NTLMSSP CHALLENGE_MESSAGE message from previous SMB2_SESSION_SETUP.
This also prevents the client from translating the DFS target
hostnames to another domain depending on the network domain search
order.
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/client/connect.c')
-rw-r--r-- | fs/smb/client/connect.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index eaa6be4456d0..9e16edf5c883 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -97,7 +97,8 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server) ss = server->dstaddr; spin_unlock(&server->srv_lock); - rc = dns_resolve_server_name_to_ip(unc, (struct sockaddr *)&ss, NULL); + rc = dns_resolve_server_name_to_ip(server->dns_dom, unc, + (struct sockaddr *)&ss, NULL); kfree(unc); if (rc < 0) { @@ -1710,6 +1711,8 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx, goto out_err; } } + if (ctx->dns_dom) + strscpy(tcp_ses->dns_dom, ctx->dns_dom); if (ctx->nosharesock) tcp_ses->nosharesock = true; |