summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2005-06-18 22:32:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:28 -0500
commitb773ca709abf1468859110a849e193362d4a2641 (patch)
tree30d724cc5221d040515df629a44a8d8c09104194
parentf7e3089c378e8b3f96e46fe1e3d1d19b99f536af (diff)
downloadsamba-b773ca709abf1468859110a849e193362d4a2641.tar.gz
samba-b773ca709abf1468859110a849e193362d4a2641.tar.bz2
samba-b773ca709abf1468859110a849e193362d4a2641.zip
r7735: Extend resolve_name function so that it's possible to pass resolve
methods explicitly or NULL for defaults saved in smb.conf. rafal (This used to be commit 121cf5ec3e075a6e37df52caad9fbc8bf7d59339)
-rw-r--r--source4/libcli/resolve/resolve.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/source4/libcli/resolve/resolve.c b/source4/libcli/resolve/resolve.c
index a3bbd60920..0b7c359ca1 100644
--- a/source4/libcli/resolve/resolve.c
+++ b/source4/libcli/resolve/resolve.c
@@ -39,10 +39,11 @@ static const struct resolve_method {
const char *name;
struct composite_context *(*send_fn)(struct nbt_name *, struct event_context *);
NTSTATUS (*recv_fn)(struct composite_context *, TALLOC_CTX *, const char **);
+
} methods[] = {
- { "bcast", resolve_name_bcast_send, resolve_name_bcast_recv },
- { "wins", resolve_name_wins_send, resolve_name_wins_recv },
- { "host", resolve_name_host_send, resolve_name_host_recv }
+ { "bcast", resolve_name_bcast_send, resolve_name_bcast_recv },
+ { "wins", resolve_name_wins_send, resolve_name_wins_recv },
+ { "host", resolve_name_host_send, resolve_name_host_recv }
};
@@ -115,7 +116,8 @@ static struct composite_context *setup_next_method(struct composite_context *c)
/*
general name resolution - async send
*/
-struct composite_context *resolve_name_send(struct nbt_name *name, struct event_context *event_ctx)
+struct composite_context *resolve_name_send(struct nbt_name *name, struct event_context *event_ctx,
+ const char **methods)
{
struct composite_context *c;
struct resolve_state *state;
@@ -130,9 +132,15 @@ struct composite_context *resolve_name_send(struct nbt_name *name, struct event_
status = nbt_name_dup(state, name, &state->name);
if (!NT_STATUS_IS_OK(status)) goto failed;
- state->methods = lp_name_resolve_order();
- if (state->methods == NULL) {
- return NULL;
+ /* use default methods from config file if not passed explicitly */
+ if (methods == NULL) {
+ state->methods = lp_name_resolve_order();
+ if (state->methods == NULL) {
+ return NULL;
+ }
+
+ } else {
+ state->methods = methods;
}
c->state = SMBCLI_REQUEST_SEND;
@@ -178,7 +186,7 @@ NTSTATUS resolve_name_recv(struct composite_context *c,
*/
NTSTATUS resolve_name(struct nbt_name *name, TALLOC_CTX *mem_ctx, const char **reply_addr)
{
- struct composite_context *c = resolve_name_send(name, NULL);
+ struct composite_context *c = resolve_name_send(name, NULL, NULL);
return resolve_name_recv(c, mem_ctx, reply_addr);
}