honour 'disable netbios' config param when using smbclient -L

Noel Power nopower at suse.com
Thu Nov 10 09:16:03 UTC 2016


Hi,
We had a customer complaining about the current smbclient behaviour
which is if config param 'disable netbios' is set then

  >smbclient -Ublah%foo -L //server

will still try to use the NBT port to list the servers and gives the
following error

"Connection to [SERVER] failed (Error NT_STATUS_UNSUCCESSFUL)
NetBIOS over TCP disabled -- no workgroup available"

I opened bug https://bugzilla.samba.org/show_bug.cgi?id=12418 for this
so please see the attached patch and bless it if acceptable
thanks,
Noel
-------------- next part --------------
From 3dad2c141a31567e6061195829c0489fa42fab3a 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, 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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/source3/client/client.c b/source3/client/client.c
index e7531d3..a0df271 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);
-- 
2.1.4



More information about the samba-technical mailing list