aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <smfrench@gmail.com>2017-08-31 22:34:24 -0400
committerSteve French <smfrench@gmail.com>2017-09-01 01:18:44 -0400
commit7e682f766f289887c5cbf7c0a1e4970103f01ac4 (patch)
tree108f320f469ede330410f57b2c534bcbe583bbce
parente89ce1f89f62c7e527db3850a91dab3389772af3 (diff)
Fix warning messages when mounting to older servers
When mounting to older servers, such as Windows XP (or even Windows 7), the limited error messages that can be passed back to user space can get confusing since the default dialect has changed from SMB1 (CIFS) to more secure SMB3 dialect. Log additional information when the user chooses to use the default dialects and when the server does not support the dialect requested. Signed-off-by: Steve French <smfrench@gmail.com> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com> Acked-by: Pavel Shilovsky <pshilov@microsoft.com>
-rw-r--r--fs/cifs/connect.c22
-rw-r--r--fs/cifs/smb2pdu.c7
2 files changed, 27 insertions, 2 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 59647eb72c5f..83a8f52cd879 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1223,6 +1223,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1223 char *tmp_end, *value; 1223 char *tmp_end, *value;
1224 char delim; 1224 char delim;
1225 bool got_ip = false; 1225 bool got_ip = false;
1226 bool got_version = false;
1226 unsigned short port = 0; 1227 unsigned short port = 0;
1227 struct sockaddr *dstaddr = (struct sockaddr *)&vol->dstaddr; 1228 struct sockaddr *dstaddr = (struct sockaddr *)&vol->dstaddr;
1228 1229
@@ -1874,24 +1875,35 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1874 pr_warn("CIFS: server netbiosname longer than 15 truncated.\n"); 1875 pr_warn("CIFS: server netbiosname longer than 15 truncated.\n");
1875 break; 1876 break;
1876 case Opt_ver: 1877 case Opt_ver:
1878 /* version of mount userspace tools, not dialect */
1877 string = match_strdup(args); 1879 string = match_strdup(args);
1878 if (string == NULL) 1880 if (string == NULL)
1879 goto out_nomem; 1881 goto out_nomem;
1880 1882
1883 /* If interface changes in mount.cifs bump to new ver */
1881 if (strncasecmp(string, "1", 1) == 0) { 1884 if (strncasecmp(string, "1", 1) == 0) {
1885 if (strlen(string) > 1) {
1886 pr_warn("Bad mount helper ver=%s. Did "
1887 "you want SMB1 (CIFS) dialect "
1888 "and mean to type vers=1.0 "
1889 "instead?\n", string);
1890 goto cifs_parse_mount_err;
1891 }
1882 /* This is the default */ 1892 /* This is the default */
1883 break; 1893 break;
1884 } 1894 }
1885 /* For all other value, error */ 1895 /* For all other value, error */
1886 pr_warn("CIFS: Invalid version specified\n"); 1896 pr_warn("CIFS: Invalid mount helper version specified\n");
1887 goto cifs_parse_mount_err; 1897 goto cifs_parse_mount_err;
1888 case Opt_vers: 1898 case Opt_vers:
1899 /* protocol version (dialect) */
1889 string = match_strdup(args); 1900 string = match_strdup(args);
1890 if (string == NULL) 1901 if (string == NULL)
1891 goto out_nomem; 1902 goto out_nomem;
1892 1903
1893 if (cifs_parse_smb_version(string, vol) != 0) 1904 if (cifs_parse_smb_version(string, vol) != 0)
1894 goto cifs_parse_mount_err; 1905 goto cifs_parse_mount_err;
1906 got_version = true;
1895 break; 1907 break;
1896 case Opt_sec: 1908 case Opt_sec:
1897 string = match_strdup(args); 1909 string = match_strdup(args);
@@ -1973,6 +1985,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1973 else if (override_gid == 1) 1985 else if (override_gid == 1)
1974 pr_notice("CIFS: ignoring forcegid mount option specified with no gid= option.\n"); 1986 pr_notice("CIFS: ignoring forcegid mount option specified with no gid= option.\n");
1975 1987
1988 if (got_version == false)
1989 pr_warn("No dialect specified on mount. Default has changed to "
1990 "a more secure dialect, SMB3 (vers=3.0), from CIFS "
1991 "(SMB1). To use the less secure SMB1 dialect to access "
1992 "old servers which do not support SMB3 specify vers=1.0"
1993 " on mount. For somewhat newer servers such as Windows "
1994 "7 try vers=2.1.\n");
1995
1976 kfree(mountdata_copy); 1996 kfree(mountdata_copy);
1977 return 0; 1997 return 0;
1978 1998
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 97edb4d376cd..7aa67206f6da 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -514,7 +514,12 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
514 * No tcon so can't do 514 * No tcon so can't do
515 * cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]); 515 * cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]);
516 */ 516 */
517 if (rc != 0) 517 if (rc == -EOPNOTSUPP) {
518 cifs_dbg(VFS, "Dialect not supported by server. Consider "
519 "specifying vers=1.0 or vers=2.1 on mount for accessing"
520 " older servers\n");
521 goto neg_exit;
522 } else if (rc != 0)
518 goto neg_exit; 523 goto neg_exit;
519 524
520 cifs_dbg(FYI, "mode 0x%x\n", rsp->SecurityMode); 525 cifs_dbg(FYI, "mode 0x%x\n", rsp->SecurityMode);