s3:smbclient: improve the error messages for smbclient -L
authorStefan Metzmacher <metze@samba.org>
Wed, 16 Aug 2017 06:55:43 +0000 (08:55 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 18 Aug 2017 23:41:24 +0000 (01:41 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12863

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/client/client.c

index 83d9b9d834285671ada44d25236907179bfc1ae1..5897cecbdf3143a3fbf1595d3d23ebe99d3a3b71 100644 (file)
@@ -5830,6 +5830,7 @@ static int do_host_query(const char *query_host)
        }
 
        if (lp_disable_netbios()) {
+               d_printf("NetBIOS over TCP disabled -- no workgroup available\n");
                goto out;
        }
 
@@ -5844,21 +5845,19 @@ static int do_host_query(const char *query_host)
                 */
 
                cli_shutdown(cli);
+               d_printf("Reconnecting with SMB1 for workgroup listing.\n");
                status = cli_cm_open(talloc_tos(), NULL,
                                     have_ip ? dest_ss_str : query_host,
                                     "IPC$", popt_get_cmdline_auth_info(),
                                     smb_encrypt, max_proto,
                                     NBT_SMB_PORT, name_type, &cli);
                if (!NT_STATUS_IS_OK(status)) {
-                       cli = NULL;
+                       d_printf("Failed to connect with SMB1 "
+                                "-- no workgroup available\n");
+                       return 0;
                }
        }
 
-       if (cli == NULL) {
-               d_printf("NetBIOS over TCP disabled -- no workgroup available\n");
-               return 0;
-       }
-
        cli_set_timeout(cli, io_timeout*1000);
        list_servers(lp_workgroup());
 out: