[PATCH] honour 'disable netbios' config param when using smbclient -L

Noel Power nopower at suse.com
Mon Nov 14 14:16:09 UTC 2016


On 14/11/16 13:41, David Disseldorp wrote:
> On Mon, 14 Nov 2016 12:17:32 +0000, Noel Power wrote:
>
>> @@ -5676,6 +5680,10 @@ static int do_message_op(struct user_auth_info *a_info)
>>  {
>>  	NTSTATUS status;
>>  
>> +	if (lp_disable_netbios()) {
>> +		return 0;
>> +	}
>> +
> I think an error should be returned (and printed) for this case.
hmm I admit I didn't think about returning an error at all, just
disabling (as in the -L case). I think that you're right in that it
makes sense to output a message in this case (because you are explicitly
trying a netbios thing) but I don't know if you would count that as an
error or not (I mean returning an error status), the attached patch
returns an error in any case

Noel
-------------- next part --------------
>From 0fe0d86368d7c8309df6c67677848493ced89603 Mon Sep 17 00:00:00 2001
From: Noel Power <noel.power at suse.com>
Date: Thu, 10 Nov 2016 08:27:57 +0000
Subject: [PATCH] s3/client: obey 'disable netbios' smb.conf param, don't
 connect via NBT port.

If 'disable netbios' is true 'smbclient -L //server' will try use the NBT
port to list the servers and 'smbclient -M //server' use the netbios
messaging WinPopup facility, we should honour the config and not do that.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12418

Signed-off-by: Noel Power <noel.power at suse.com>
---
 source3/client/client.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/source3/client/client.c b/source3/client/client.c
index e7531d3..36caf17 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -5598,6 +5598,10 @@ static int do_host_query(const char *query_host)
 		}
 	}
 
+	if (lp_disable_netbios()) {
+		goto out;
+	}
+
 	if (port != NBT_SMB_PORT) {
 
 		/* Workgroups simply don't make sense over anything
@@ -5621,7 +5625,7 @@ static int do_host_query(const char *query_host)
 
 	cli_set_timeout(cli, io_timeout*1000);
 	list_servers(lp_workgroup());
-
+out:
 	cli_shutdown(cli);
 
 	return(0);
@@ -5676,6 +5680,11 @@ static int do_message_op(struct user_auth_info *a_info)
 {
 	NTSTATUS status;
 
+	if (lp_disable_netbios()) {
+		d_printf("NetBIOS over TCP disabled.\n");
+		return 1;
+	}
+
 	status = cli_connect_nb(desthost, have_ip ? &dest_ss : NULL,
 				port ? port : NBT_SMB_PORT, name_type,
 				lp_netbios_name(), SMB_SIGNING_DEFAULT, 0, &cli);
-- 
2.1.4



More information about the samba-technical mailing list