summaryrefslogtreecommitdiff
path: root/lib/param
diff options
context:
space:
mode:
authorDavid Mulder <dmulder@suse.com>2019-11-08 17:10:47 +0000
committerNoel Power <npower@samba.org>2019-11-12 17:52:28 +0000
commit30e8f513a8bae58d7d4e88fad8f8d5497076c553 (patch)
tree8ea491c07c9b60f53790b35f8d59b873a6181db7 /lib/param
parent6cf443ab1f9d0d939d721f58386669202d2fb56e (diff)
downloadsamba-30e8f513a8bae58d7d4e88fad8f8d5497076c553.tar.gz
Detect when command line max protocol < min protocol
Due to the increased default minimum protocol level to SMB2, some users notice that specifying smbclient -m NT1 fails with NT_STATUS_CONNECTION_DISCONNECTED, with no SMB traffic on the wire. Report when the max protocol is set less than the min protocol. Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <npower@samba.org> Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Tue Nov 12 17:52:28 UTC 2019 on sn-devel-184
Diffstat (limited to 'lib/param')
-rw-r--r--lib/param/loadparm.c14
-rw-r--r--lib/param/param_table.c11
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index 9a577aa188c..5334e9c4e5d 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -3117,6 +3117,7 @@ const char *lp_default_path(void)
static bool lpcfg_update(struct loadparm_context *lp_ctx)
{
struct debug_settings settings;
+ int max_protocol, min_protocol;
TALLOC_CTX *tmp_ctx;
tmp_ctx = talloc_new(lp_ctx);
@@ -3160,6 +3161,19 @@ static bool lpcfg_update(struct loadparm_context *lp_ctx)
unsetenv("SOCKET_TESTNONBLOCK");
}
+ /* Check if command line max protocol < min protocol, if so
+ * report a warning to the user.
+ */
+ max_protocol = lpcfg_client_max_protocol(lp_ctx);
+ min_protocol = lpcfg_client_min_protocol(lp_ctx);
+ if (lpcfg_client_max_protocol(lp_ctx) < lpcfg_client_min_protocol(lp_ctx)) {
+ const char *max_protocolp, *min_protocolp;
+ max_protocolp = lpcfg_get_smb_protocol(max_protocol);
+ min_protocolp = lpcfg_get_smb_protocol(min_protocol);
+ DBG_ERR("Max protocol %s is less than min protocol %s.\n",
+ max_protocolp, min_protocolp);
+ }
+
TALLOC_FREE(tmp_ctx);
return true;
}
diff --git a/lib/param/param_table.c b/lib/param/param_table.c
index 2fd3361f996..47b85de1f87 100644
--- a/lib/param/param_table.c
+++ b/lib/param/param_table.c
@@ -61,6 +61,17 @@ static const struct enum_list enum_protocol[] = {
{-1, NULL}
};
+const char* lpcfg_get_smb_protocol(int type)
+{
+ int i;
+ for (i = 1; enum_protocol[i].value != -1; i++) {
+ if (enum_protocol[i].value == type) {
+ return enum_protocol[i].name;
+ }
+ }
+ return NULL;
+}
+
static const struct enum_list enum_security[] = {
{SEC_AUTO, "AUTO"},
{SEC_USER, "USER"},