From c38c2765d1059b33f044a42c6555f3d10d339911 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 17:17:37 +0100 Subject: Remove yet more uses of global_loadparm. (This used to be commit e01c1e87c0fe9709df7eb5b863f7ce85564174cd) --- source4/libcli/resolve/bcast.c | 10 +++++++--- source4/libcli/resolve/nbtlist.c | 5 ++++- source4/libcli/resolve/wins.c | 10 +++++++--- 3 files changed, 18 insertions(+), 7 deletions(-) (limited to 'source4/libcli/resolve') diff --git a/source4/libcli/resolve/bcast.c b/source4/libcli/resolve/bcast.c index c8d4ab2df3..2e2eb05397 100644 --- a/source4/libcli/resolve/bcast.c +++ b/source4/libcli/resolve/bcast.c @@ -29,6 +29,7 @@ struct resolve_bcast_data { struct interface *ifaces; uint16_t nbt_port; + int nbt_timeout; }; /** @@ -62,7 +63,7 @@ struct composite_context *resolve_name_bcast_send(TALLOC_CTX *mem_ctx, } address_list[count] = NULL; - c = resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, data->ifaces, data->nbt_port, true, false); + c = resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, data->ifaces, data->nbt_port, data->nbt_timeout, true, false); talloc_free(address_list); return c; @@ -84,22 +85,25 @@ NTSTATUS resolve_name_bcast(struct nbt_name *name, TALLOC_CTX *mem_ctx, struct interface *ifaces, uint16_t nbt_port, + int nbt_timeout, const char **reply_addr) { struct resolve_bcast_data *data = talloc(mem_ctx, struct resolve_bcast_data); struct composite_context *c; data->ifaces = talloc_reference(data, ifaces); data->nbt_port = nbt_port; + data->nbt_timeout = nbt_timeout; c = resolve_name_bcast_send(mem_ctx, NULL, data, name); return resolve_name_bcast_recv(c, mem_ctx, reply_addr); } -bool resolve_context_add_bcast_method(struct resolve_context *ctx, struct interface *ifaces, uint16_t nbt_port) +bool resolve_context_add_bcast_method(struct resolve_context *ctx, struct interface *ifaces, uint16_t nbt_port, int nbt_timeout) { struct resolve_bcast_data *data = talloc(ctx, struct resolve_bcast_data); data->ifaces = ifaces; data->nbt_port = nbt_port; + data->nbt_timeout = nbt_timeout; return resolve_context_add_method(ctx, resolve_name_bcast_send, resolve_name_bcast_recv, data); } @@ -107,5 +111,5 @@ bool resolve_context_add_bcast_method_lp(struct resolve_context *ctx, struct loa { struct interface *ifaces; load_interfaces(ctx, lp_interfaces(lp_ctx), &ifaces); - return resolve_context_add_bcast_method(ctx, ifaces, lp_nbt_port(lp_ctx)); + return resolve_context_add_bcast_method(ctx, ifaces, lp_nbt_port(lp_ctx), lp_parm_int(lp_ctx, NULL, "nbt", "timeout", 1)); } diff --git a/source4/libcli/resolve/nbtlist.c b/source4/libcli/resolve/nbtlist.c index e1452c09d2..34578e953a 100644 --- a/source4/libcli/resolve/nbtlist.c +++ b/source4/libcli/resolve/nbtlist.c @@ -102,6 +102,7 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx, const char **address_list, struct interface *ifaces, uint16_t nbt_port, + int nbt_timeout, bool broadcast, bool wins_lookup) { @@ -161,7 +162,7 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx, 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(global_loadparm, NULL, "nbt", "timeout", 1); + state->io_queries[i].in.timeout = nbt_timeout; state->io_queries[i].in.retries = 2; state->queries[i] = nbt_name_query_send(state->nbtsock, &state->io_queries[i]); @@ -201,12 +202,14 @@ NTSTATUS resolve_name_nbtlist(struct nbt_name *name, const char **address_list, struct interface *ifaces, uint16_t nbt_port, + int nbt_timeout, bool broadcast, bool wins_lookup, const char **reply_addr) { struct composite_context *c = resolve_name_nbtlist_send(mem_ctx, NULL, name, address_list, ifaces, nbt_port, + nbt_timeout, broadcast, wins_lookup); return resolve_name_nbtlist_recv(c, mem_ctx, reply_addr); } diff --git a/source4/libcli/resolve/wins.c b/source4/libcli/resolve/wins.c index 78624ad81a..3ec180f332 100644 --- a/source4/libcli/resolve/wins.c +++ b/source4/libcli/resolve/wins.c @@ -29,6 +29,7 @@ struct resolve_wins_data { const char **address_list; struct interface *ifaces; uint16_t nbt_port; + int nbt_timeout; }; /** @@ -42,7 +43,7 @@ struct composite_context *resolve_name_wins_send( { struct resolve_wins_data *wins_data = talloc_get_type(userdata, struct resolve_wins_data); if (wins_data->address_list == NULL) return NULL; - return resolve_name_nbtlist_send(mem_ctx, event_ctx, name, wins_data->address_list, wins_data->ifaces, wins_data->nbt_port, false, true); + return resolve_name_nbtlist_send(mem_ctx, event_ctx, name, wins_data->address_list, wins_data->ifaces, wins_data->nbt_port, wins_data->nbt_timeout, false, true); } /* @@ -62,6 +63,7 @@ NTSTATUS resolve_name_wins(struct nbt_name *name, const char **address_list, struct interface *ifaces, uint16_t nbt_port, + int nbt_timeout, const char **reply_addr) { struct composite_context *c; @@ -69,16 +71,18 @@ NTSTATUS resolve_name_wins(struct nbt_name *name, wins_data->address_list = address_list; wins_data->ifaces = ifaces; wins_data->nbt_port = nbt_port; + wins_data->nbt_timeout = nbt_timeout; c = resolve_name_wins_send(mem_ctx, NULL, wins_data, name); return resolve_name_wins_recv(c, mem_ctx, reply_addr); } -bool resolve_context_add_wins_method(struct resolve_context *ctx, const char **address_list, struct interface *ifaces, uint16_t nbt_port) +bool resolve_context_add_wins_method(struct resolve_context *ctx, const char **address_list, struct interface *ifaces, uint16_t nbt_port, int nbt_timeout) { struct resolve_wins_data *wins_data = talloc(ctx, struct resolve_wins_data); wins_data->address_list = str_list_copy(wins_data, address_list); wins_data->ifaces = talloc_reference(wins_data, ifaces); wins_data->nbt_port = nbt_port; + wins_data->nbt_timeout = nbt_timeout; return resolve_context_add_method(ctx, resolve_name_wins_send, resolve_name_wins_recv, wins_data); } @@ -87,5 +91,5 @@ bool resolve_context_add_wins_method_lp(struct resolve_context *ctx, struct load { struct interface *ifaces; load_interfaces(ctx, lp_interfaces(lp_ctx), &ifaces); - return resolve_context_add_wins_method(ctx, lp_wins_server_list(lp_ctx), ifaces, lp_nbt_port(lp_ctx)); + return resolve_context_add_wins_method(ctx, lp_wins_server_list(lp_ctx), ifaces, lp_nbt_port(lp_ctx), lp_parm_int(lp_ctx, NULL, "nbt", "timeout", 1)); } -- cgit From 10169a203019445e6d325a5c1559de3c73782237 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 17:54:24 +0100 Subject: Remove more global_loadparm instance.s (This used to be commit a1280252ce924df69d911e597b7f65d8038abef9) --- source4/libcli/resolve/nbtlist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/libcli/resolve') diff --git a/source4/libcli/resolve/nbtlist.c b/source4/libcli/resolve/nbtlist.c index 34578e953a..887bdd7ecf 100644 --- a/source4/libcli/resolve/nbtlist.c +++ b/source4/libcli/resolve/nbtlist.c @@ -141,7 +141,8 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx, return c; } - state->nbtsock = nbt_name_socket_init(state, event_ctx); + state->nbtsock = nbt_name_socket_init(state, event_ctx, + lp_iconv_convenience(global_loadparm)); if (composite_nomem(state->nbtsock, c)) return c; /* count the address_list size */ -- cgit