diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-02-07 11:56:34 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:09:35 -0500 |
commit | fcb78064bf760ab72d213b604cef9688edf42b92 (patch) | |
tree | c945ba52f9b23745d391acf8a1bdbf8439d01abd /source4/utils | |
parent | d09311baa72c0ffa6768a379053dc0bfd38ecbdb (diff) | |
download | samba-fcb78064bf760ab72d213b604cef9688edf42b92.tar.gz samba-fcb78064bf760ab72d213b604cef9688edf42b92.tar.bz2 samba-fcb78064bf760ab72d213b604cef9688edf42b92.zip |
r5260: - show an error message on nmblookup failure
- always try to enable broadcast on nbt name sockets (this matches
samba3 behaviour better)
(This used to be commit 919bc14e7bbc04479cf11f7a7fd4c5e46616ef46)
Diffstat (limited to 'source4/utils')
-rw-r--r-- | source4/utils/nmblookup.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source4/utils/nmblookup.c b/source4/utils/nmblookup.c index 3e3a4415d5..f41ab4cc6e 100644 --- a/source4/utils/nmblookup.c +++ b/source4/utils/nmblookup.c @@ -176,6 +176,7 @@ static void process_one(const char *name) enum nbt_name_type node_type = NBT_NAME_CLIENT; char *node_name, *p; struct nbt_name_socket *nbtsock; + NTSTATUS status; if (options.find_master) { node_type = NBT_NAME_MASTER; @@ -196,7 +197,6 @@ static void process_one(const char *name) nbtsock = nbt_name_socket_init(tmp_ctx, NULL); if (options.root_port) { - NTSTATUS status; status = socket_listen(nbtsock->sock, "0.0.0.0", NBT_NAME_SERVICE_PORT, 0, 0); if (!NT_STATUS_IS_OK(status)) { printf("Failed to bind to local port 137 - %s\n", nt_errstr(status)); @@ -211,18 +211,22 @@ static void process_one(const char *name) } if (options.broadcast_address) { - do_node_query(nbtsock, options.broadcast_address, node_name, node_type, True); + status = do_node_query(nbtsock, options.broadcast_address, node_name, node_type, True); } else if (options.unicast_address) { - do_node_query(nbtsock, options.unicast_address, node_name, node_type, False); + status = do_node_query(nbtsock, options.unicast_address, node_name, node_type, False); } else { int i, num_interfaces = iface_count(); for (i=0;i<num_interfaces;i++) { const char *bcast = sys_inet_ntoa(*iface_n_bcast(i)); - NTSTATUS status = do_node_query(nbtsock, bcast, node_name, node_type, True); + status = do_node_query(nbtsock, bcast, node_name, node_type, True); if (NT_STATUS_IS_OK(status)) break; } } + if (!NT_STATUS_IS_OK(status)) { + printf("Lookup failed - %s\n", nt_errstr(status)); + } + talloc_free(tmp_ctx); } |