From: Thomas Werschlein Date: Thu, 30 Aug 2018 16:29:20 +0000 (+0200) Subject: cifs: connect to servername instead of IP for IPC$ share X-Git-Tag: v4.18.9~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15c4b1902f0e35dd51bb79fca73c50b6d14df699;p=thirdparty%2Fkernel%2Fstable.git cifs: connect to servername instead of IP for IPC$ share commit 395a2076b4064f97d3fce03af15210ff2a7bb7f9 upstream. This patch is required allows access to a Microsoft fileserver failover cluster behind a 1:1 NAT firewall. The change also provides stronger context for authentication and share connection (see MS-SMB2 3.3.5.7 and MS-SRVS 3.1.6.8) as noted by Tom Talpey, and addresses comments about the buffer size for the UNC made by Aurélien Aptel. Signed-off-by: Thomas Werschlein Signed-off-by: Steve French CC: Tom Talpey Reviewed-by: Aurelien Aptel CC: Stable Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 9d02563b2147e..44043f809a3c1 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2523,7 +2523,7 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb_vol *volume_info) if (tcon == NULL) return -ENOMEM; - snprintf(unc, sizeof(unc), "\\\\%s\\IPC$", ses->serverName); + snprintf(unc, sizeof(unc), "\\\\%s\\IPC$", ses->server->hostname); /* cannot fail */ nls_codepage = load_nls_default();