[SCM] Samba Shared Repository - branch master updated

Noel Power npower at samba.org
Tue Nov 12 17:53:01 UTC 2019


The branch, master has been updated
       via  30e8f513a8b Detect when command line max protocol < min protocol
      from  6cf443ab1f9 s4-libcli: Remove unused header from composite/composite.c

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 30e8f513a8bae58d7d4e88fad8f8d5497076c553
Author: David Mulder <dmulder at suse.com>
Date:   Fri Nov 8 17:10:47 2019 +0000

    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 at suse.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>
    
    Autobuild-User(master): Noel Power <npower at samba.org>
    Autobuild-Date(master): Tue Nov 12 17:52:28 UTC 2019 on sn-devel-184

-----------------------------------------------------------------------

Summary of changes:
 lib/param/loadparm.c     | 14 ++++++++++++++
 lib/param/param_table.c  | 11 +++++++++++
 source3/param/loadparm.c | 14 ++++++++++++++
 3 files changed, 39 insertions(+)


Changeset truncated at 500 lines:

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"},
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index b1a52055ade..433762eedfb 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -3861,6 +3861,7 @@ static bool lp_load_ex(const char *pszFname,
 	bool bRetval;
 	TALLOC_CTX *frame = talloc_stackframe();
 	struct loadparm_context *lp_ctx;
+	int max_protocol, min_protocol;
 
 	DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
 
@@ -3999,6 +4000,19 @@ static bool lp_load_ex(const char *pszFname,
 
 	bAllowIncludeRegistry = true;
 
+	/* Check if command line max protocol < min protocol, if so
+	 * report a warning to the user.
+	 */
+	max_protocol = lp_client_max_protocol();
+	min_protocol = lp_client_min_protocol();
+	if (max_protocol < min_protocol) {
+		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(frame);
 	return (bRetval);
 }


-- 
Samba Shared Repository



More information about the samba-cvs mailing list