From bfbd7e95b6b531d159c0e9615e04f8320ff21487 Mon Sep 17 00:00:00 2001 From: Steve French Date: Tue, 19 Jun 2018 14:34:08 -0500 Subject: cifs: allow disabling insecure dialects in the config commit 7420451f6a109f7f8f1bf283f34d08eba3259fb3 upstream. allow disabling cifs (SMB1 ie vers=1.0) and vers=2.0 in the config for the build of cifs.ko if want to always prevent mounting with these less secure dialects. Signed-off-by: Steve French Reviewed-by: Aurelien Aptel Reviewed-by: Jeremy Allison Cc: Alakesh Haloi Signed-off-by: Greg Kroah-Hartman --- fs/cifs/connect.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'fs/cifs/connect.c') diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index fd24c72bd2cd..d6248137c219 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -1130,6 +1130,7 @@ cifs_parse_smb_version(char *value, struct smb_vol *vol) substring_t args[MAX_OPT_ARGS]; switch (match_token(value, cifs_smb_version_tokens, args)) { +#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY case Smb_1: vol->ops = &smb1_operations; vol->vals = &smb1_values; @@ -1138,6 +1139,14 @@ cifs_parse_smb_version(char *value, struct smb_vol *vol) vol->ops = &smb20_operations; vol->vals = &smb20_values; break; +#else + case Smb_1: + cifs_dbg(VFS, "vers=1.0 (cifs) mount not permitted when legacy dialects disabled\n"); + return 1; + case Smb_20: + cifs_dbg(VFS, "vers=2.0 mount not permitted when legacy dialects disabled\n"); + return 1; +#endif /* CIFS_ALLOW_INSECURE_LEGACY */ case Smb_21: vol->ops = &smb21_operations; vol->vals = &smb21_values; -- cgit v1.2.3