diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-12-13 11:03:52 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-12-17 20:25:52 +0100 |
commit | 937fdb8a7e348103708adbdafcff28b05cc1fda3 (patch) | |
tree | 64400af2c9ead91e6352a219ceef5085debe0edd /source4 | |
parent | c8565c0e7acc6febf1b4015bde6baa1c5b7adddc (diff) | |
download | samba-937fdb8a7e348103708adbdafcff28b05cc1fda3.tar.gz samba-937fdb8a7e348103708adbdafcff28b05cc1fda3.tar.bz2 samba-937fdb8a7e348103708adbdafcff28b05cc1fda3.zip |
s4:libcli/resolve: pass down flags to the resolver backends
metze
Diffstat (limited to 'source4')
-rw-r--r-- | source4/libcli/resolve/bcast.c | 6 | ||||
-rw-r--r-- | source4/libcli/resolve/dns_ex.c | 3 | ||||
-rw-r--r-- | source4/libcli/resolve/host.c | 4 | ||||
-rw-r--r-- | source4/libcli/resolve/nbtlist.c | 4 | ||||
-rw-r--r-- | source4/libcli/resolve/resolve.c | 11 | ||||
-rw-r--r-- | source4/libcli/resolve/resolve.h | 1 | ||||
-rw-r--r-- | source4/libcli/resolve/testsuite.c | 2 | ||||
-rw-r--r-- | source4/libcli/resolve/wins.c | 6 |
8 files changed, 29 insertions, 8 deletions
diff --git a/source4/libcli/resolve/bcast.c b/source4/libcli/resolve/bcast.c index a572e873fc..285a612fb1 100644 --- a/source4/libcli/resolve/bcast.c +++ b/source4/libcli/resolve/bcast.c @@ -37,7 +37,7 @@ struct resolve_bcast_data { */ struct composite_context *resolve_name_bcast_send(TALLOC_CTX *mem_ctx, struct event_context *event_ctx, - void *userdata, + void *userdata, uint32_t flags, struct nbt_name *name) { int num_interfaces; @@ -63,7 +63,9 @@ 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, data->nbt_timeout, true, false); + c = resolve_name_nbtlist_send(mem_ctx, event_ctx, flags, name, + address_list, data->ifaces, data->nbt_port, + data->nbt_timeout, true, false); talloc_free(address_list); return c; diff --git a/source4/libcli/resolve/dns_ex.c b/source4/libcli/resolve/dns_ex.c index 4bcf50a014..36d7269be4 100644 --- a/source4/libcli/resolve/dns_ex.c +++ b/source4/libcli/resolve/dns_ex.c @@ -43,6 +43,7 @@ struct dns_ex_state { bool do_getaddrinfo; bool do_fallback; bool do_srv; + uint32_t flags; struct nbt_name name; struct socket_address **addrs; pid_t child; @@ -393,6 +394,7 @@ static void pipe_handler(struct event_context *ev, struct fd_event *fde, struct composite_context *resolve_name_dns_ex_send(TALLOC_CTX *mem_ctx, struct event_context *event_ctx, void *privdata, + uint32_t flags, struct nbt_name *name, bool do_getaddrinfo, bool do_fallback, @@ -425,6 +427,7 @@ struct composite_context *resolve_name_dns_ex_send(TALLOC_CTX *mem_ctx, state->do_getaddrinfo = do_getaddrinfo; state->do_fallback = do_fallback; state->do_srv = do_srv; + state->flags = flags; state->child_fd = fd[0]; state->event_ctx = c->event_ctx; diff --git a/source4/libcli/resolve/host.c b/source4/libcli/resolve/host.c index 2facb54362..1ad1473e92 100644 --- a/source4/libcli/resolve/host.c +++ b/source4/libcli/resolve/host.c @@ -34,10 +34,10 @@ */ struct composite_context *resolve_name_host_send(TALLOC_CTX *mem_ctx, struct event_context *event_ctx, - void *privdata, + void *privdata, uint32_t flags, struct nbt_name *name) { - return resolve_name_dns_ex_send(mem_ctx, event_ctx, NULL, + return resolve_name_dns_ex_send(mem_ctx, event_ctx, NULL, flags, name, true, true, false); } diff --git a/source4/libcli/resolve/nbtlist.c b/source4/libcli/resolve/nbtlist.c index 76721e2af5..962dd420ab 100644 --- a/source4/libcli/resolve/nbtlist.c +++ b/source4/libcli/resolve/nbtlist.c @@ -34,6 +34,7 @@ #include "libcli/resolve/resolve.h" struct nbtlist_state { + uint16_t flags; struct nbt_name name; struct nbt_name_socket *nbtsock; int num_queries; @@ -98,6 +99,7 @@ static void nbtlist_handler(struct nbt_name_request *req) */ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx, struct event_context *event_ctx, + uint32_t flags, struct nbt_name *name, const char **address_list, struct interface *ifaces, @@ -119,6 +121,8 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx, if (composite_nomem(state, c)) return c; c->private_data = state; + state->flags = flags; + c->status = nbt_name_dup(state, name, &state->name); if (!composite_is_ok(c)) return c; diff --git a/source4/libcli/resolve/resolve.c b/source4/libcli/resolve/resolve.c index 68b806506d..072eeabb7a 100644 --- a/source4/libcli/resolve/resolve.c +++ b/source4/libcli/resolve/resolve.c @@ -31,6 +31,7 @@ struct resolve_state { struct resolve_context *ctx; struct resolve_method *method; + uint32_t flags; struct nbt_name name; struct composite_context *creq; struct socket_address **addrs; @@ -111,7 +112,10 @@ static struct composite_context *setup_next_method(struct composite_context *c) do { if (state->method) { - creq = state->method->send_fn(c, c->event_ctx, state->method->privdata, &state->name); + creq = state->method->send_fn(c, c->event_ctx, + state->method->privdata, + state->flags, + &state->name); } if (creq == NULL && state->method) state->method = state->method->next; @@ -129,6 +133,7 @@ static struct composite_context *setup_next_method(struct composite_context *c) general name resolution - async send */ struct composite_context *resolve_name_all_send(struct resolve_context *ctx, + uint32_t flags, struct nbt_name *name, struct event_context *event_ctx) { @@ -148,6 +153,8 @@ struct composite_context *resolve_name_all_send(struct resolve_context *ctx, if (composite_nomem(state, c)) return c; c->private_data = state; + state->flags = flags; + c->status = nbt_name_dup(state, name, &state->name); if (!composite_is_ok(c)) return c; @@ -203,7 +210,7 @@ struct composite_context *resolve_name_send(struct resolve_context *ctx, struct nbt_name *name, struct event_context *event_ctx) { - return resolve_name_all_send(ctx, name, event_ctx); + return resolve_name_all_send(ctx, 0, name, event_ctx); } NTSTATUS resolve_name_recv(struct composite_context *c, diff --git a/source4/libcli/resolve/resolve.h b/source4/libcli/resolve/resolve.h index f83db3f71d..9808b81393 100644 --- a/source4/libcli/resolve/resolve.h +++ b/source4/libcli/resolve/resolve.h @@ -29,6 +29,7 @@ struct event_context; typedef struct composite_context *(*resolve_name_send_fn)(TALLOC_CTX *mem_ctx, struct event_context *, void *privdata, + uint32_t flags, struct nbt_name *); typedef NTSTATUS (*resolve_name_recv_fn)(struct composite_context *creq, TALLOC_CTX *mem_ctx, diff --git a/source4/libcli/resolve/testsuite.c b/source4/libcli/resolve/testsuite.c index 34de1158a5..7e002bd310 100644 --- a/source4/libcli/resolve/testsuite.c +++ b/source4/libcli/resolve/testsuite.c @@ -44,7 +44,7 @@ static bool test_async_resolve(struct torture_context *tctx) host, timelimit); while (timeval_elapsed(&tv) < timelimit) { struct socket_address **s; - struct composite_context *c = resolve_name_host_send(mem_ctx, ev, NULL, &n); + struct composite_context *c = resolve_name_host_send(mem_ctx, ev, NULL, 0, &n); torture_assert(tctx, c != NULL, "resolve_name_host_send"); torture_assert_ntstatus_ok(tctx, resolve_name_host_recv(c, mem_ctx, &s), "async resolve failed"); diff --git a/source4/libcli/resolve/wins.c b/source4/libcli/resolve/wins.c index ba25b6c5c9..31e6b9e75c 100644 --- a/source4/libcli/resolve/wins.c +++ b/source4/libcli/resolve/wins.c @@ -40,11 +40,15 @@ struct composite_context *resolve_name_wins_send( TALLOC_CTX *mem_ctx, struct event_context *event_ctx, void *userdata, + uint32_t flags, struct nbt_name *name) { 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, wins_data->nbt_timeout, false, true); + return resolve_name_nbtlist_send(mem_ctx, event_ctx, flags, name, + wins_data->address_list, wins_data->ifaces, + wins_data->nbt_port, wins_data->nbt_timeout, + false, true); } /* |