summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-01-24 01:57:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:51:25 -0500
commite2ce6fec9cfb9d3efbe0e97a8faf7f60a8ea3a1d (patch)
tree1e5e103a15e1824f8cc70dc913b46e6de9789cd2
parentf705108a8a14427f6ef114ad76d4f5e48759136e (diff)
downloadsamba-e2ce6fec9cfb9d3efbe0e97a8faf7f60a8ea3a1d.tar.gz
samba-e2ce6fec9cfb9d3efbe0e97a8faf7f60a8ea3a1d.tar.bz2
samba-e2ce6fec9cfb9d3efbe0e97a8faf7f60a8ea3a1d.zip
r13103: Walk the names in the node status request, so I can find a server
name, and use that. (I was trying to find a machine by the name of __SAMBA__) Andrew Bartlett (This used to be commit cde044d023c7580442bceb60ac62dc4cfc1b85fe)
-rw-r--r--source4/libcli/finddcs.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/source4/libcli/finddcs.c b/source4/libcli/finddcs.c
index 3b72cceba0..9caf9b5578 100644
--- a/source4/libcli/finddcs.c
+++ b/source4/libcli/finddcs.c
@@ -209,23 +209,26 @@ static void fallback_node_status(struct finddcs_state *state)
/* We have a node status reply (or perhaps a timeout) */
static void fallback_node_status_replied(struct nbt_name_request *name_req)
{
+ int i;
struct finddcs_state *state = talloc_get_type(name_req->async.private, struct finddcs_state);
state->ctx->status = nbt_name_status_recv(name_req, state, &state->node_status);
if (!composite_is_ok(state->ctx)) return;
- if (state->node_status.out.status.num_names > 0) {
- int i;
- char *name = talloc_strndup(state->dcs, state->node_status.out.status.names[0].name, 15);
- /* Strip space padding */
- if (name) {
- i = MIN(strlen(name), 15);
- for (; i > 0 && name[i - 1] == ' '; i--) {
- name[i - 1] = '\0';
+ for (i=0; i < state->node_status.out.status.num_names; i++) {
+ int j;
+ if (state->node_status.out.status.names[i].type == NBT_NAME_SERVER) {
+ char *name = talloc_strndup(state->dcs, state->node_status.out.status.names[0].name, 15);
+ /* Strip space padding */
+ if (name) {
+ j = MIN(strlen(name), 15);
+ for (; j > 0 && name[j - 1] == ' '; j--) {
+ name[j - 1] = '\0';
+ }
}
+ state->dcs[0].name = name;
+ composite_done(state->ctx);
+ return;
}
- state->dcs[0].name = name;
- composite_done(state->ctx);
- return;
}
composite_error(state->ctx, NT_STATUS_NO_LOGON_SERVERS);
}