diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-11 22:23:14 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:49:32 +0100 |
commit | 6f2252dace1629d7b5c5637b103caa28d2c89b07 (patch) | |
tree | fc09abaf04401ef510d55866066738840d052ebf /source4/libcli/resolve | |
parent | f9948d18d73fb8d8711c3b5a46b1d83c881a0084 (diff) | |
download | samba-6f2252dace1629d7b5c5637b103caa28d2c89b07.tar.gz samba-6f2252dace1629d7b5c5637b103caa28d2c89b07.tar.bz2 samba-6f2252dace1629d7b5c5637b103caa28d2c89b07.zip |
r26401: Don't cache interfaces context in libnetif.
(This used to be commit 9f975417cc66bfd4589da38bfd23731dbe0e6153)
Diffstat (limited to 'source4/libcli/resolve')
-rw-r--r-- | source4/libcli/resolve/bcast.c | 15 | ||||
-rw-r--r-- | source4/libcli/resolve/nbtlist.c | 4 | ||||
-rw-r--r-- | source4/libcli/resolve/resolve.h | 1 |
3 files changed, 14 insertions, 6 deletions
diff --git a/source4/libcli/resolve/bcast.c b/source4/libcli/resolve/bcast.c index 1733ca9d2e..d1f3d65faf 100644 --- a/source4/libcli/resolve/bcast.c +++ b/source4/libcli/resolve/bcast.c @@ -33,17 +33,19 @@ struct composite_context *resolve_name_bcast_send(TALLOC_CTX *mem_ctx, void *userdata, struct nbt_name *name) { - struct loadparm_context *lp_ctx = userdata; - int num_interfaces = iface_count(lp_ctx); + int num_interfaces; const char **address_list; struct composite_context *c; int i, count=0; + struct interface *ifaces = userdata; + + num_interfaces = iface_count(ifaces); address_list = talloc_array(mem_ctx, const char *, num_interfaces+1); if (address_list == NULL) return NULL; for (i=0;i<num_interfaces;i++) { - const char *bcast = iface_n_bcast(lp_ctx, i); + const char *bcast = iface_n_bcast(ifaces, i); if (bcast == NULL) continue; address_list[count] = talloc_strdup(address_list, bcast); if (address_list[count] == NULL) { @@ -74,14 +76,17 @@ NTSTATUS resolve_name_bcast_recv(struct composite_context *c, */ NTSTATUS resolve_name_bcast(struct nbt_name *name, TALLOC_CTX *mem_ctx, + struct interface *ifaces, const char **reply_addr) { - struct composite_context *c = resolve_name_bcast_send(mem_ctx, NULL, NULL, name); + struct composite_context *c = resolve_name_bcast_send(mem_ctx, NULL, ifaces, name); return resolve_name_bcast_recv(c, mem_ctx, reply_addr); } bool resolve_context_add_bcast_method(struct resolve_context *ctx, struct loadparm_context *lp_ctx) { + struct interface *ifaces; + load_interfaces(lp_interfaces(lp_ctx), &ifaces); return resolve_context_add_method(ctx, resolve_name_bcast_send, resolve_name_bcast_recv, - lp_ctx); + ifaces); } diff --git a/source4/libcli/resolve/nbtlist.c b/source4/libcli/resolve/nbtlist.c index daa602f97c..6c12fe706b 100644 --- a/source4/libcli/resolve/nbtlist.c +++ b/source4/libcli/resolve/nbtlist.c @@ -49,6 +49,7 @@ static void nbtlist_handler(struct nbt_name_request *req) struct composite_context); struct nbtlist_state *state = talloc_get_type(c->private_data, struct nbtlist_state); struct nbt_name_query *q; + struct interface *ifaces; int i; for (i=0;i<state->num_queries;i++) { @@ -75,9 +76,10 @@ static void nbtlist_handler(struct nbt_name_request *req) } /* favor a local address if possible */ + load_interfaces(lp_interfaces(global_loadparm), &ifaces); state->reply_addr = NULL; for (i=0;i<q->out.num_addrs;i++) { - if (iface_is_local(global_loadparm, q->out.reply_addrs[i])) { + if (iface_is_local(ifaces, q->out.reply_addrs[i])) { state->reply_addr = talloc_steal(state, q->out.reply_addrs[i]); break; diff --git a/source4/libcli/resolve/resolve.h b/source4/libcli/resolve/resolve.h index 9282074aa4..79b91dc836 100644 --- a/source4/libcli/resolve/resolve.h +++ b/source4/libcli/resolve/resolve.h @@ -26,6 +26,7 @@ typedef struct composite_context *(*resolve_name_send_fn)(TALLOC_CTX *mem_ctx, struct event_context *, void *privdata, struct nbt_name *); typedef NTSTATUS (*resolve_name_recv_fn)(struct composite_context *, TALLOC_CTX *, const char **); #include "libcli/resolve/proto.h" +struct interface; #include "libcli/resolve/lp_proto.h" #endif /* __RESOLVE_H__ */ |