s3:utils:net: Print debug message about Netbios
authorJustin Stephenson <jstephen@redhat.com>
Mon, 17 Dec 2018 20:17:24 +0000 (15:17 -0500)
committerNoel Power <npower@samba.org>
Wed, 9 Jan 2019 21:38:21 +0000 (22:38 +0100)
With a preceding patch, cli_connect_nb() will return
NT_STATUS_NOT_SUPPORTED when 'disable netbios' is set in smb.conf.

Print an informative error message to indicate Netbios is disabled
if this occurs.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13727

Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Noel Power <nopower@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Wed Jan  9 22:38:21 CET 2019 on sn-devel-144

source3/utils/net_rpc.c
source3/utils/net_time.c

index c300b8a..f2d63d2 100644 (file)
@@ -7455,6 +7455,9 @@ bool net_rpc_check(struct net_context *c, unsigned flags)
                                lp_netbios_name(), SMB_SIGNING_IPC_DEFAULT,
                                0, &cli);
        if (!NT_STATUS_IS_OK(status)) {
+               if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
+                       DBG_ERR("NetBIOS support disabled, unable to connect\n");
+               }
                return false;
        }
        status = smbXcli_negprot(cli->conn, cli->timeout, PROTOCOL_CORE,
index 0091fc8..5e6cf2e 100644 (file)
@@ -37,8 +37,13 @@ static time_t cli_servertime(const char *host,
        status = cli_connect_nb(host, dest_ss, 0, 0x20, lp_netbios_name(),
                                SMB_SIGNING_DEFAULT, 0, &cli);
        if (!NT_STATUS_IS_OK(status)) {
-               fprintf(stderr, _("Can't contact server %s. Error %s\n"),
-                       host, nt_errstr(status));
+               if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
+                       fprintf(stderr, "Can't contact server %s. NetBIOS support disabled,"
+                               " Error %s\n", host, nt_errstr(status));
+               } else {
+                       fprintf(stderr, "Can't contact server %s. Error %s\n",
+                               host, nt_errstr(status));
+               }
                goto done;
        }