Author: mimir Date: 2005-09-29 22:37:15 +0000 (Thu, 29 Sep 2005) New Revision: 10636
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10636 Log: Formatting for better readability. rafal Modified: branches/SAMBA_4_0/source/libcli/resolve/nbtlist.c branches/SAMBA_4_0/source/libcli/resolve/resolve.c Changeset: Modified: branches/SAMBA_4_0/source/libcli/resolve/nbtlist.c =================================================================== --- branches/SAMBA_4_0/source/libcli/resolve/nbtlist.c 2005-09-29 22:36:41 UTC (rev 10635) +++ branches/SAMBA_4_0/source/libcli/resolve/nbtlist.c 2005-09-29 22:37:15 UTC (rev 10636) @@ -51,6 +51,7 @@ for (i=0;i<state->num_queries;i++) { if (req == state->queries[i]) break; } + if (i == state->num_queries) { /* not for us?! */ c->status = NT_STATUS_INTERNAL_ERROR; @@ -61,15 +62,18 @@ c->status = nbt_name_query_recv(req, state, &state->io_queries[i]); if (!NT_STATUS_IS_OK(c->status)) { c->state = COMPOSITE_STATE_ERROR; + } else { if (state->io_queries[i].out.num_addrs < 1) { c->state = COMPOSITE_STATE_ERROR; c->status = NT_STATUS_UNEXPECTED_NETWORK_ERROR; + } else { struct nbt_name_query *q = &state->io_queries[i]; c->state = COMPOSITE_STATE_DONE; /* favor a local address if possible */ state->reply_addr = NULL; + for (i=0;i<q->out.num_addrs;i++) { if (iface_is_local(q->out.reply_addrs[i])) { state->reply_addr = talloc_steal(state, @@ -77,6 +81,7 @@ break; } } + if (state->reply_addr == NULL) { state->reply_addr = talloc_steal(state, q->out.reply_addrs[0]); @@ -135,18 +140,19 @@ if (!state->queries) goto failed; for (i=0;i<state->num_queries;i++) { - state->io_queries[i].in.name = state->name; - state->io_queries[i].in.dest_addr = talloc_strdup(state->io_queries, address_list[i]); + state->io_queries[i].in.name = state->name; + state->io_queries[i].in.dest_addr = talloc_strdup(state->io_queries, address_list[i]); if (!state->io_queries[i].in.dest_addr) goto failed; - state->io_queries[i].in.broadcast = broadcast; + + state->io_queries[i].in.broadcast = broadcast; state->io_queries[i].in.wins_lookup = wins_lookup; - state->io_queries[i].in.timeout = lp_parm_int(-1, "nbt", "timeout", 1); + state->io_queries[i].in.timeout = lp_parm_int(-1, "nbt", "timeout", 1); + state->io_queries[i].in.retries = 2; - state->io_queries[i].in.retries = 2; state->queries[i] = nbt_name_query_send(state->nbtsock, &state->io_queries[i]); if (!state->queries[i]) goto failed; - state->queries[i]->async.fn = nbtlist_handler; + state->queries[i]->async.fn = nbtlist_handler; state->queries[i]->async.private = c; } Modified: branches/SAMBA_4_0/source/libcli/resolve/resolve.c =================================================================== --- branches/SAMBA_4_0/source/libcli/resolve/resolve.c 2005-09-29 22:36:41 UTC (rev 10635) +++ branches/SAMBA_4_0/source/libcli/resolve/resolve.c 2005-09-29 22:37:15 UTC (rev 10636) @@ -103,6 +103,7 @@ creq = method->send_fn(&state->name, c->event_ctx); } if (creq == NULL && state->methods[0]) state->methods++; + } while (!creq && state->methods[0]); if (creq) { @@ -138,9 +139,11 @@ c->state = COMPOSITE_STATE_IN_PROGRESS; c->private_data = state; + if (event_ctx == NULL) { c->event_ctx = event_context_init(c); if (c->event_ctx == NULL) goto failed; + } else { c->event_ctx = talloc_reference(c, event_ctx); }
