From c4d51d8d17f04583868f1fdc82322b26bcb1c7a0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 1 Dec 2012 08:56:57 +0100 Subject: s4:libcli/finddcs_cldap: try all NBT#1C addresses Signed-off-by: Stefan Metzmacher Reviewed-by: Michael Adam --- source4/libcli/finddcs_cldap.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'source4/libcli') diff --git a/source4/libcli/finddcs_cldap.c b/source4/libcli/finddcs_cldap.c index 38e828fa98..a7162f81ca 100644 --- a/source4/libcli/finddcs_cldap.c +++ b/source4/libcli/finddcs_cldap.c @@ -53,7 +53,7 @@ static bool finddcs_cldap_nbt_lookup(struct finddcs_cldap_state *state, struct finddcs *io, struct resolve_context *resolve_ctx, struct tevent_context *event_ctx); -static void finddcs_cldap_name_resolved(struct composite_context *ctx); +static void finddcs_cldap_nbt_resolved(struct composite_context *ctx); static void finddcs_cldap_next_server(struct finddcs_cldap_state *state); static bool finddcs_cldap_ipaddress(struct finddcs_cldap_state *state, struct finddcs *io); @@ -200,7 +200,7 @@ static bool finddcs_cldap_nbt_lookup(struct finddcs_cldap_state *state, if (tevent_req_nomem(creq, state->req)) { return false; } - creq->async.fn = finddcs_cldap_name_resolved; + creq->async.fn = finddcs_cldap_nbt_resolved; creq->async.private_data = state; return true; } @@ -315,27 +315,23 @@ static void finddcs_cldap_netlogon_replied(struct tevent_req *subreq) /* handle NBT name lookup reply */ -static void finddcs_cldap_name_resolved(struct composite_context *ctx) +static void finddcs_cldap_nbt_resolved(struct composite_context *ctx) { struct finddcs_cldap_state *state = talloc_get_type(ctx->async.private_data, struct finddcs_cldap_state); - const char *address; NTSTATUS status; + unsigned i; - status = resolve_name_recv(ctx, state, &address); + status = resolve_name_multiple_recv(ctx, state, &state->srv_addresses); if (tevent_req_nterror(state->req, status)) { DEBUG(2,("finddcs: No matching NBT <1c> server found\n")); return; } - DEBUG(4,("finddcs: Found NBT <1c> server at %s\n", address)); - - state->srv_addresses = talloc_array(state, const char *, 2); - if (tevent_req_nomem(state->srv_addresses, state->req)) { - return; + for (i=0; state->srv_addresses[i]; i++) { + DEBUG(4,("finddcs: NBT <1c> response %u at '%s'\n", + i, state->srv_addresses[i])); } - state->srv_addresses[0] = address; - state->srv_addresses[1] = NULL; state->srv_address_index = 0; -- cgit