Commit 7e682f76 authored by Steve French's avatar Steve French

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: default avatarSteve French <smfrench@gmail.com>
Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
Acked-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
parent e89ce1f8
...@@ -1223,6 +1223,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, ...@@ -1223,6 +1223,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
char *tmp_end, *value; char *tmp_end, *value;
char delim; char delim;
bool got_ip = false; bool got_ip = false;
bool got_version = false;
unsigned short port = 0; unsigned short port = 0;
struct sockaddr *dstaddr = (struct sockaddr *)&vol->dstaddr; struct sockaddr *dstaddr = (struct sockaddr *)&vol->dstaddr;
...@@ -1874,24 +1875,35 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, ...@@ -1874,24 +1875,35 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
pr_warn("CIFS: server netbiosname longer than 15 truncated.\n"); pr_warn("CIFS: server netbiosname longer than 15 truncated.\n");
break; break;
case Opt_ver: case Opt_ver:
/* version of mount userspace tools, not dialect */
string = match_strdup(args); string = match_strdup(args);
if (string == NULL) if (string == NULL)
goto out_nomem; goto out_nomem;
/* If interface changes in mount.cifs bump to new ver */
if (strncasecmp(string, "1", 1) == 0) { if (strncasecmp(string, "1", 1) == 0) {
if (strlen(string) > 1) {
pr_warn("Bad mount helper ver=%s. Did "
"you want SMB1 (CIFS) dialect "
"and mean to type vers=1.0 "
"instead?\n", string);
goto cifs_parse_mount_err;
}
/* This is the default */ /* This is the default */
break; break;
} }
/* For all other value, error */ /* For all other value, error */
pr_warn("CIFS: Invalid version specified\n"); pr_warn("CIFS: Invalid mount helper version specified\n");
goto cifs_parse_mount_err; goto cifs_parse_mount_err;
case Opt_vers: case Opt_vers:
/* protocol version (dialect) */
string = match_strdup(args); string = match_strdup(args);
if (string == NULL) if (string == NULL)
goto out_nomem; goto out_nomem;
if (cifs_parse_smb_version(string, vol) != 0) if (cifs_parse_smb_version(string, vol) != 0)
goto cifs_parse_mount_err; goto cifs_parse_mount_err;
got_version = true;
break; break;
case Opt_sec: case Opt_sec:
string = match_strdup(args); string = match_strdup(args);
...@@ -1973,6 +1985,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, ...@@ -1973,6 +1985,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
else if (override_gid == 1) else if (override_gid == 1)
pr_notice("CIFS: ignoring forcegid mount option specified with no gid= option.\n"); pr_notice("CIFS: ignoring forcegid mount option specified with no gid= option.\n");
if (got_version == false)
pr_warn("No dialect specified on mount. Default has changed to "
"a more secure dialect, SMB3 (vers=3.0), from CIFS "
"(SMB1). To use the less secure SMB1 dialect to access "
"old servers which do not support SMB3 specify vers=1.0"
" on mount. For somewhat newer servers such as Windows "
"7 try vers=2.1.\n");
kfree(mountdata_copy); kfree(mountdata_copy);
return 0; return 0;
......
...@@ -514,7 +514,12 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses) ...@@ -514,7 +514,12 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
* No tcon so can't do * No tcon so can't do
* cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]); * cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]);
*/ */
if (rc != 0) if (rc == -EOPNOTSUPP) {
cifs_dbg(VFS, "Dialect not supported by server. Consider "
"specifying vers=1.0 or vers=2.1 on mount for accessing"
" older servers\n");
goto neg_exit;
} else if (rc != 0)
goto neg_exit; goto neg_exit;
cifs_dbg(FYI, "mode 0x%x\n", rsp->SecurityMode); cifs_dbg(FYI, "mode 0x%x\n", rsp->SecurityMode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment