[PATCH] honour 'disable netbios' config param when using smbclient -L
Noel Power
nopower at suse.com
Mon Nov 14 12:17:32 UTC 2016
Hi
On 14/11/16 08:14, Noel Power wrote:
> On 11/11/16 22:08, Jeremy Allison wrote:
>> On Thu, Nov 10, 2016 at 05:35:43PM +0100, David Disseldorp wrote:
[...]
>>
>>> so please see the attached patch and bless it if acceptable
>>> Looks okay to me, Noel. However, there's a chance that it'll upset
>>> users
>>> relying on the existing server-only "disable netbios" behaviour (the
>>> man
>>> page is a little ambiguous WRT what should be affected. Also, if we do
>>> go down this route, then for consistency it might also be worth
>>> intervening in do_message_op().
>>>
>>> Interested to hear what others think.
>> I think this patch is correct, but as David says I'm not sure
>> it goes far enough. Can you add the same check in do_message_op()
>> as well ?
> absolutely, I will look into it and submit a new patch later
>
please find attached v2 of the patch
Noel
-------------- next part --------------
>From aaa610e340490be0b0cb6f610e54a81bc69ea7f6 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 | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/source3/client/client.c b/source3/client/client.c
index e7531d3..5b83cb5 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,10 @@ static int do_message_op(struct user_auth_info *a_info)
{
NTSTATUS status;
+ if (lp_disable_netbios()) {
+ return 0;
+ }
+
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