summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/auth/auth_server.c6
-rw-r--r--source4/auth/kerberos/krb5_init_context.c3
-rw-r--r--source4/client/client.c6
-rw-r--r--source4/lib/socket/connect.c9
-rw-r--r--source4/lib/socket/connect_multi.c15
-rw-r--r--source4/lib/socket/socket.h9
-rw-r--r--source4/lib/socket/testsuite.c5
-rw-r--r--source4/libcli/cliconnect.c4
-rw-r--r--source4/libcli/finddcs.c8
-rw-r--r--source4/libcli/ldap/ldap_client.c5
-rw-r--r--source4/libcli/raw/clisocket.c6
-rw-r--r--source4/libcli/raw/libcliraw.h1
-rw-r--r--source4/libcli/resolve/bcast.c8
-rw-r--r--source4/libcli/resolve/host.c9
-rw-r--r--source4/libcli/resolve/resolve.c110
-rw-r--r--source4/libcli/resolve/resolve.h2
-rw-r--r--source4/libcli/resolve/testsuite.c2
-rw-r--r--source4/libcli/resolve/wins.c26
-rw-r--r--source4/libcli/smb2/connect.c8
-rw-r--r--source4/libcli/smb2/smb2_calls.h1
-rw-r--r--source4/libcli/smb_composite/connect.c3
-rw-r--r--source4/libcli/wrepl/winsrepl.c3
-rw-r--r--source4/libnet/libnet.c3
-rw-r--r--source4/libnet/libnet.h2
-rw-r--r--source4/libnet/libnet_lookup.c12
-rw-r--r--source4/libnet/libnet_lookup.h2
-rw-r--r--source4/libnet/libnet_site.c2
-rw-r--r--source4/librpc/rpc/dcerpc.h2
-rw-r--r--source4/librpc/rpc/dcerpc_connect.c7
-rw-r--r--source4/librpc/rpc/dcerpc_secondary.c3
-rw-r--r--source4/librpc/rpc/dcerpc_sock.c7
-rw-r--r--source4/scripting/ejs/smbcalls_nbt.c2
-rw-r--r--source4/torture/basic/base.c2
-rw-r--r--source4/torture/ldap/cldapbench.c2
-rw-r--r--source4/torture/libnet/libnet_lookup.c4
-rw-r--r--source4/torture/nbt/dgram.c6
-rw-r--r--source4/torture/nbt/nbt.c2
-rw-r--r--source4/torture/smb2/scan.c5
-rw-r--r--source4/torture/smb2/util.c3
-rw-r--r--source4/winbind/wb_dom_info.c2
-rw-r--r--source4/winbind/wb_dom_info_trusted.c4
41 files changed, 199 insertions, 122 deletions
diff --git a/source4/auth/auth_server.c b/source4/auth/auth_server.c
index b5fcda15b3..f200ad9665 100644
--- a/source4/auth/auth_server.c
+++ b/source4/auth/auth_server.c
@@ -24,7 +24,7 @@
Support for server level security.
****************************************************************************/
-static struct smbcli_state *server_cryptkey(TALLOC_CTX *mem_ctx, bool unicode, int maxprotocol, const char **name_resolve_order)
+static struct smbcli_state *server_cryptkey(TALLOC_CTX *mem_ctx, bool unicode, int maxprotocol, struct resolve_context *resolve_ctx)
{
struct smbcli_state *cli = NULL;
fstring desthost;
@@ -45,7 +45,7 @@ static struct smbcli_state *server_cryptkey(TALLOC_CTX *mem_ctx, bool unicode, i
while(next_token( &p, desthost, LIST_SEP, sizeof(desthost))) {
strupper(desthost);
- if(!resolve_name( desthost, &dest_ip, 0x20, name_resolve_order)) {
+ if(!resolve_name(resolve_ctx, desthost, &dest_ip, 0x20)) {
DEBUG(1,("server_cryptkey: Can't resolve address for %s\n",desthost));
continue;
}
@@ -215,7 +215,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context
if (cli) {
} else {
- cli = server_cryptkey(mem_ctx, lp_unicode(auth_context->lp_ctx), lp_cli_maxprotocol(auth_context->lp_ctx), lp_name_resolve_order(auth_context->lp_ctx));
+ cli = server_cryptkey(mem_ctx, lp_unicode(auth_context->lp_ctx), lp_cli_maxprotocol(auth_context->lp_ctx), lp_resolve_context(auth_context->lp_ctx));
locally_made_cli = true;
}
diff --git a/source4/auth/kerberos/krb5_init_context.c b/source4/auth/kerberos/krb5_init_context.c
index e3479b12d1..d0bc383ea0 100644
--- a/source4/auth/kerberos/krb5_init_context.c
+++ b/source4/auth/kerberos/krb5_init_context.c
@@ -30,6 +30,7 @@
#include "lib/events/events.h"
#include "roken.h"
#include "param/param.h"
+#include "libcli/resolve/resolve.h"
/*
context structure for operations on cldap packets
@@ -277,7 +278,7 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
}
status = socket_connect_ev(smb_krb5->sock, NULL, remote_addr, 0,
- lp_name_resolve_order(global_loadparm), ev);
+ lp_resolve_context(global_loadparm), ev);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(smb_krb5);
continue;
diff --git a/source4/client/client.c b/source4/client/client.c
index 43135e13ea..98b13aba4c 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -3061,7 +3061,7 @@ static int do_host_query(struct loadparm_context *lp_ctx, const char *query_host
/****************************************************************************
handle a message operation
****************************************************************************/
-static int do_message_op(const char *netbios_name, const char *desthost, const char *destip, int name_type, const char **name_resolve_order, int max_xmit, int max_mux)
+static int do_message_op(const char *netbios_name, const char *desthost, const char *destip, int name_type, struct resolve_context *resolve_ctx, int max_xmit, int max_mux)
{
struct nbt_name called, calling;
const char *server_name;
@@ -3073,7 +3073,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
server_name = destip ? destip : desthost;
- if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, name_resolve_order, max_xmit, max_mux)) {
+ if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, resolve_ctx, max_xmit, max_mux)) {
d_printf("Connection to %s failed\n", server_name);
return 1;
}
@@ -3221,7 +3221,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
}
if (message) {
- return do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost, dest_ip, name_type, lp_name_resolve_order(cmdline_lp_ctx), lp_max_xmit(cmdline_lp_ctx), lp_maxmux(cmdline_lp_ctx));
+ return do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost, dest_ip, name_type, lp_resolve_context(cmdline_lp_ctx), lp_max_xmit(cmdline_lp_ctx), lp_maxmux(cmdline_lp_ctx));
}
if (!do_connect(ctx, desthost, service, cmdline_credentials))
diff --git a/source4/lib/socket/connect.c b/source4/lib/socket/connect.c
index cad8967dab..e70d091275 100644
--- a/source4/lib/socket/connect.c
+++ b/source4/lib/socket/connect.c
@@ -85,7 +85,7 @@ struct composite_context *socket_connect_send(struct socket_context *sock,
struct socket_address *my_address,
struct socket_address *server_address,
uint32_t flags,
- const char **name_resolve_order,
+ struct resolve_context *resolve_ctx,
struct event_context *event_ctx)
{
struct composite_context *result;
@@ -127,8 +127,7 @@ struct composite_context *socket_connect_send(struct socket_context *sock,
struct nbt_name name;
struct composite_context *creq;
make_nbt_name_client(&name, server_address->addr);
- creq = resolve_name_send(&name, result->event_ctx,
- lp_name_resolve_order(global_loadparm));
+ creq = resolve_name_send(resolve_ctx, &name, result->event_ctx);
if (composite_nomem(creq, result)) return result;
composite_continue(result, creq, continue_resolve_name, result);
return result;
@@ -207,11 +206,11 @@ NTSTATUS socket_connect_recv(struct composite_context *result)
NTSTATUS socket_connect_ev(struct socket_context *sock,
struct socket_address *my_address,
struct socket_address *server_address,
- uint32_t flags, const char **name_resolve_order,
+ uint32_t flags, struct resolve_context *resolve_ctx,
struct event_context *ev)
{
struct composite_context *ctx;
ctx = socket_connect_send(sock, my_address,
- server_address, flags, name_resolve_order, ev);
+ server_address, flags, resolve_ctx, ev);
return socket_connect_recv(ctx);
}
diff --git a/source4/lib/socket/connect_multi.c b/source4/lib/socket/connect_multi.c
index 58ab673965..2f736a4b05 100644
--- a/source4/lib/socket/connect_multi.c
+++ b/source4/lib/socket/connect_multi.c
@@ -38,7 +38,7 @@ struct connect_multi_state {
int num_ports;
uint16_t *ports;
- const char **name_resolve_order;
+ struct resolve_context *resolve_ctx;
struct socket_context *sock;
uint16_t result_port;
@@ -70,7 +70,7 @@ _PUBLIC_ struct composite_context *socket_connect_multi_send(
const char *server_address,
int num_server_ports,
uint16_t *server_ports,
- const char **name_resolve_order,
+ struct resolve_context *resolve_ctx,
struct event_context *event_ctx)
{
struct composite_context *result;
@@ -90,7 +90,7 @@ _PUBLIC_ struct composite_context *socket_connect_multi_send(
if (composite_nomem(multi->server_address, result)) goto failed;
multi->num_ports = num_server_ports;
- multi->name_resolve_order = str_list_copy(multi, name_resolve_order);
+ multi->resolve_ctx = talloc_reference(multi, resolve_ctx);
multi->ports = talloc_array(multi, uint16_t, multi->num_ports);
if (composite_nomem(multi->ports, result)) goto failed;
@@ -107,8 +107,7 @@ _PUBLIC_ struct composite_context *socket_connect_multi_send(
struct nbt_name name;
struct composite_context *creq;
make_nbt_name_client(&name, server_address);
- creq = resolve_name_send(&name, result->event_ctx,
- name_resolve_order);
+ creq = resolve_name_send(resolve_ctx, &name, result->event_ctx);
if (composite_nomem(creq, result)) goto failed;
composite_continue(result, creq, continue_resolve_name, result);
return result;
@@ -161,7 +160,7 @@ static void connect_multi_next_socket(struct composite_context *result)
talloc_steal(state, state->sock);
creq = socket_connect_send(state->sock, NULL,
- state->addr, 0, multi->name_resolve_order,
+ state->addr, 0, multi->resolve_ctx,
result->event_ctx);
if (composite_nomem(creq, result)) return;
talloc_steal(state, creq);
@@ -269,7 +268,7 @@ _PUBLIC_ NTSTATUS socket_connect_multi_recv(struct composite_context *ctx,
NTSTATUS socket_connect_multi(TALLOC_CTX *mem_ctx,
const char *server_address,
int num_server_ports, uint16_t *server_ports,
- const char **name_resolve_order,
+ struct resolve_context *resolve_ctx,
struct event_context *event_ctx,
struct socket_context **result,
uint16_t *result_port)
@@ -277,7 +276,7 @@ NTSTATUS socket_connect_multi(TALLOC_CTX *mem_ctx,
struct composite_context *ctx =
socket_connect_multi_send(mem_ctx, server_address,
num_server_ports, server_ports,
- name_resolve_order,
+ resolve_ctx,
event_ctx);
return socket_connect_multi_recv(ctx, mem_ctx, result, result_port);
}
diff --git a/source4/lib/socket/socket.h b/source4/lib/socket/socket.h
index 24bc5f1aac..4baa0cfbb1 100644
--- a/source4/lib/socket/socket.h
+++ b/source4/lib/socket/socket.h
@@ -126,6 +126,7 @@ struct socket_context {
int family;
};
+struct resolve_context;
/* prototypes */
NTSTATUS socket_create_with_ops(TALLOC_CTX *mem_ctx, const struct socket_ops *ops,
@@ -178,21 +179,21 @@ struct composite_context *socket_connect_send(struct socket_context *sock,
struct socket_address *my_address,
struct socket_address *server_address,
uint32_t flags,
- const char **name_resolve_order,
+ struct resolve_context *resolve_ctx,
struct event_context *event_ctx);
NTSTATUS socket_connect_recv(struct composite_context *ctx);
NTSTATUS socket_connect_ev(struct socket_context *sock,
struct socket_address *my_address,
struct socket_address *server_address,
uint32_t flags,
- const char **name_resolve_order,
+ struct resolve_context *resolve_ctx,
struct event_context *ev);
struct composite_context *socket_connect_multi_send(TALLOC_CTX *mem_ctx,
const char *server_address,
int num_server_ports,
uint16_t *server_ports,
- const char **name_resolve_order,
+ struct resolve_context *resolve_ctx,
struct event_context *event_ctx);
NTSTATUS socket_connect_multi_recv(struct composite_context *ctx,
TALLOC_CTX *mem_ctx,
@@ -200,7 +201,7 @@ NTSTATUS socket_connect_multi_recv(struct composite_context *ctx,
uint16_t *port);
NTSTATUS socket_connect_multi(TALLOC_CTX *mem_ctx, const char *server_address,
int num_server_ports, uint16_t *server_ports,
- const char **name_resolve_order,
+ struct resolve_context *resolve_ctx,
struct event_context *event_ctx,
struct socket_context **result,
uint16_t *port);
diff --git a/source4/lib/socket/testsuite.c b/source4/lib/socket/testsuite.c
index dea740dbc8..874508aaa7 100644
--- a/source4/lib/socket/testsuite.c
+++ b/source4/lib/socket/testsuite.c
@@ -26,8 +26,9 @@
#include "lib/socket/netif.h"
#include "torture/torture.h"
#include "param/param.h"
+#include "libcli/resolve/resolve.h"
-/*
+/**
basic testing of udp routines
*/
static bool test_udp(struct torture_context *tctx)
@@ -146,7 +147,7 @@ static bool test_tcp(struct torture_context *tctx)
torture_comment(tctx, "server port is %d\n", srv_addr->port);
- status = socket_connect_ev(sock2, NULL, srv_addr, 0, lp_name_resolve_order(tctx->lp_ctx), ev);
+ status = socket_connect_ev(sock2, NULL, srv_addr, 0, lp_resolve_context(tctx->lp_ctx), ev);
torture_assert_ntstatus_ok(tctx, status, "connect() on socket 2");
status = socket_accept(sock1, &sock3);
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index b9fd06db1a..d70f592d9d 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -31,12 +31,12 @@
wrapper around smbcli_sock_connect()
*/
bool smbcli_socket_connect(struct smbcli_state *cli, const char *server,
- const char **name_resolve_order,
+ struct resolve_context *resolve_ctx,
int max_xmit, int max_mux)
{
struct smbcli_socket *sock;
- sock = smbcli_sock_connect_byname(server, 0, NULL, name_resolve_order,
+ sock = smbcli_sock_connect_byname(server, 0, NULL, resolve_ctx,
NULL);
if (sock == NULL) return false;
diff --git a/source4/libcli/finddcs.c b/source4/libcli/finddcs.c
index 83bf9837f9..415c84a6bd 100644
--- a/source4/libcli/finddcs.c
+++ b/source4/libcli/finddcs.c
@@ -65,7 +65,7 @@ struct composite_context *finddcs_send(TALLOC_CTX *mem_ctx,
const char *domain_name,
int name_type,
struct dom_sid *domain_sid,
- const char **methods,
+ struct resolve_context *resolve_ctx,
struct event_context *event_ctx,
struct messaging_context *msg_ctx)
{
@@ -96,7 +96,7 @@ struct composite_context *finddcs_send(TALLOC_CTX *mem_ctx,
state->msg_ctx = msg_ctx;
make_nbt_name(&name, state->domain_name, name_type);
- creq = resolve_name_send(&name, event_ctx, methods);
+ creq = resolve_name_send(resolve_ctx, &name, event_ctx);
composite_continue(c, creq, finddcs_name_resolved, state);
return c;
}
@@ -249,7 +249,7 @@ NTSTATUS finddcs(TALLOC_CTX *mem_ctx,
const char *my_netbios_name,
const char *domain_name, int name_type,
struct dom_sid *domain_sid,
- const char **methods,
+ struct resolve_context *resolve_ctx,
struct event_context *event_ctx,
struct messaging_context *msg_ctx,
int *num_dcs, struct nbt_dc_name **dcs)
@@ -257,7 +257,7 @@ NTSTATUS finddcs(TALLOC_CTX *mem_ctx,
struct composite_context *c = finddcs_send(mem_ctx,
my_netbios_name,
domain_name, name_type,
- domain_sid, methods,
+ domain_sid, resolve_ctx,
event_ctx, msg_ctx);
return finddcs_recv(c, mem_ctx, num_dcs, dcs);
}
diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c
index 906e9c2574..6b8a7a3f28 100644
--- a/source4/libcli/ldap/ldap_client.c
+++ b/source4/libcli/ldap/ldap_client.c
@@ -35,6 +35,7 @@
#include "auth/gensec/gensec.h"
#include "system/time.h"
#include "param/param.h"
+#include "libcli/resolve/resolve.h"
/**
@@ -355,7 +356,7 @@ struct composite_context *ldap_connect_send(struct ldap_connection *conn,
}
ctx = socket_connect_send(conn->sock, NULL, unix_addr,
- 0, lp_name_resolve_order(conn->lp_ctx), conn->event.event_ctx);
+ 0, lp_resolve_context(conn->lp_ctx), conn->event.event_ctx);
ctx->async.fn = ldap_connect_recv_unix_conn;
ctx->async.private_data = state;
return result;
@@ -368,7 +369,7 @@ struct composite_context *ldap_connect_send(struct ldap_connection *conn,
}
ctx = socket_connect_multi_send(state, conn->host, 1, &conn->port,
- lp_name_resolve_order(conn->lp_ctx), conn->event.event_ctx);
+ lp_resolve_context(conn->lp_ctx), conn->event.event_ctx);
if (ctx == NULL) goto failed;
ctx->async.fn = ldap_connect_recv_tcp_conn;
diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c
index 9b744dcc18..c09104e256 100644
--- a/source4/libcli/raw/clisocket.c
+++ b/source4/libcli/raw/clisocket.c
@@ -96,7 +96,7 @@ struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx,
ctx = socket_connect_multi_send(state, host_addr,
state->num_ports, state->ports,
- lp_name_resolve_order(global_loadparm),
+ lp_resolve_context(global_loadparm),
state->ctx->event_ctx);
if (ctx == NULL) goto failed;
ctx->async.fn = smbcli_sock_connect_recv_conn;
@@ -200,7 +200,7 @@ resolve a hostname and connect
****************************************************************************/
struct smbcli_socket *smbcli_sock_connect_byname(const char *host, int port,
TALLOC_CTX *mem_ctx,
- const char **name_resolve_order,
+ struct resolve_context *resolve_ctx,
struct event_context *event_ctx)
{
int name_type = NBT_NAME_SERVER;
@@ -241,7 +241,7 @@ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, int port,
make_nbt_name(&nbt_name, host, name_type);
- status = resolve_name(&nbt_name, tmp_ctx, &address, event_ctx, name_resolve_order);
+ status = resolve_name(resolve_ctx, &nbt_name, tmp_ctx, &address, event_ctx);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(tmp_ctx);
return NULL;
diff --git a/source4/libcli/raw/libcliraw.h b/source4/libcli/raw/libcliraw.h
index a11a9c9e58..6c97e61f04 100644
--- a/source4/libcli/raw/libcliraw.h
+++ b/source4/libcli/raw/libcliraw.h
@@ -30,6 +30,7 @@ struct smbcli_request; /* forward declare */
struct smbcli_session; /* forward declare */
struct smbcli_transport; /* forward declare */
+struct resolve_context;
struct cli_credentials;
/* default timeout for all smb requests */
diff --git a/source4/libcli/resolve/bcast.c b/source4/libcli/resolve/bcast.c
index ad574e4c9e..5a2c49c5ad 100644
--- a/source4/libcli/resolve/bcast.c
+++ b/source4/libcli/resolve/bcast.c
@@ -30,6 +30,7 @@
*/
struct composite_context *resolve_name_bcast_send(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx,
+ void *userdata,
struct nbt_name *name)
{
int num_interfaces = iface_count(global_loadparm);
@@ -74,7 +75,12 @@ NTSTATUS resolve_name_bcast(struct nbt_name *name,
TALLOC_CTX *mem_ctx,
const char **reply_addr)
{
- struct composite_context *c = resolve_name_bcast_send(mem_ctx, NULL, name);
+ struct composite_context *c = resolve_name_bcast_send(mem_ctx, NULL, NULL, name);
return resolve_name_bcast_recv(c, mem_ctx, reply_addr);
}
+bool resolve_context_add_bcast_method(struct resolve_context *ctx)
+{
+ return resolve_context_add_method(ctx, resolve_name_bcast_send, resolve_name_bcast_recv,
+ NULL);
+}
diff --git a/source4/libcli/resolve/host.c b/source4/libcli/resolve/host.c
index e98bbc51b2..4b8f3f9553 100644
--- a/source4/libcli/resolve/host.c
+++ b/source4/libcli/resolve/host.c
@@ -34,6 +34,7 @@
#include "system/filesys.h"
#include "libcli/composite/composite.h"
#include "librpc/gen_ndr/ndr_nbt.h"
+#include "libcli/resolve/resolve.h"
struct host_state {
struct nbt_name name;
@@ -123,6 +124,7 @@ static void pipe_handler(struct event_context *ev, struct fd_event *fde,
*/
struct composite_context *resolve_name_host_send(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx,
+ void *privdata,
struct nbt_name *name)
{
struct composite_context *c;
@@ -213,7 +215,12 @@ NTSTATUS resolve_name_host(struct nbt_name *name,
TALLOC_CTX *mem_ctx,
const char **reply_addr)
{
- struct composite_context *c = resolve_name_host_send(mem_ctx, NULL, name);
+ struct composite_context *c = resolve_name_host_send(mem_ctx, NULL, NULL, name);
return resolve_name_host_recv(c, mem_ctx, reply_addr);
}
+bool resolve_context_add_host_method(struct resolve_context *ctx)
+{
+ return resolve_context_add_method(ctx, resolve_name_host_send, resolve_name_host_recv,
+ NULL);
+}
diff --git a/source4/libcli/resolve/resolve.c b/source4/libcli/resolve/resolve.c
index 0f8839a3b7..f0d9c07874 100644
--- a/source4/libcli/resolve/resolve.c
+++ b/source4/libcli/resolve/resolve.c
@@ -4,6 +4,7 @@
general name resolution interface
Copyright (C) Andrew Tridgell 2005
+ Copyright (C) Jelmer Vernooij 2007
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,57 +27,67 @@
#include "librpc/gen_ndr/ndr_nbt.h"
#include "param/param.h"
#include "system/network.h"
+#include "util/dlinklist.h"
struct resolve_state {
+ struct resolve_context *ctx;
+ struct resolve_method *method;
struct nbt_name name;
- const char **methods;
struct composite_context *creq;
const char *reply_addr;
};
static struct composite_context *setup_next_method(struct composite_context *c);
-/* pointers to the resolver backends */
-static const struct resolve_method {
- const char *name;
- struct composite_context *(*send_fn)(TALLOC_CTX *mem_ctx, struct event_context *, struct nbt_name *);
- NTSTATUS (*recv_fn)(struct composite_context *, TALLOC_CTX *, const char **);
-} resolve_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 }
+struct resolve_context {
+ struct resolve_method {
+ resolve_name_send_fn send_fn;
+ resolve_name_recv_fn recv_fn;
+ void *privdata;
+ struct resolve_method *prev, *next;
+ } *methods;
};
+/**
+ * Initialize a resolve context
+ */
+struct resolve_context *resolve_context_init(TALLOC_CTX *mem_ctx)
+{
+ return talloc_zero(mem_ctx, struct resolve_context);
+}
-/*
- find a matching backend
-*/
-static const struct resolve_method *find_method(const char *name)
+/**
+ * Add a resolve method
+ */
+bool resolve_context_add_method(struct resolve_context *ctx, resolve_name_send_fn send_fn,
+ resolve_name_recv_fn recv_fn, void *userdata)
{
- int i;
- if (name == NULL) return NULL;
- for (i=0;i<ARRAY_SIZE(resolve_methods);i++) {
- if (strcasecmp(name, resolve_methods[i].name) == 0) {
- return &resolve_methods[i];
- }
- }
- return NULL;
+ struct resolve_method *method = talloc_zero(ctx, struct resolve_method);
+
+ if (method == NULL)
+ return false;
+
+ method->send_fn = send_fn;
+ method->recv_fn = recv_fn;
+ method->privdata = userdata;
+ DLIST_ADD_END(ctx->methods, method, struct resolve_method *);
+ return true;
}
-/*
+/**
handle completion of one name resolve method
*/
static void resolve_handler(struct composite_context *creq)
{
struct composite_context *c = (struct composite_context *)creq->async.private_data;
struct resolve_state *state = talloc_get_type(c->private_data, struct resolve_state);
- const struct resolve_method *method = find_method(state->methods[0]);
+ const struct resolve_method *method = state->method;
c->status = method->recv_fn(creq, state, &state->reply_addr);
if (!NT_STATUS_IS_OK(c->status)) {
- state->methods++;
+ state->method = state->method->next;
state->creq = setup_next_method(c);
if (state->creq != NULL) {
return;
@@ -100,13 +111,12 @@ static struct composite_context *setup_next_method(struct composite_context *c)
struct composite_context *creq = NULL;
do {
- const struct resolve_method *method = find_method(state->methods[0]);
- if (method) {
- creq = method->send_fn(c, c->event_ctx, &state->name);
+ if (state->method) {
+ creq = state->method->send_fn(c, c->event_ctx, state->method->privdata, &state->name);
}
- if (creq == NULL && state->methods[0]) state->methods++;
+ if (creq == NULL && state->method) state->method = state->method->next;
- } while (!creq && state->methods[0]);
+ } while (!creq && state->method);
if (creq) {
creq->async.fn = resolve_handler;
@@ -119,8 +129,9 @@ 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,
- const char **methods)
+struct composite_context *resolve_name_send(struct resolve_context *ctx,
+ struct nbt_name *name,
+ struct event_context *event_ctx)
{
struct composite_context *c;
struct resolve_state *state;
@@ -128,7 +139,7 @@ struct composite_context *resolve_name_send(struct nbt_name *name, struct event_
c = composite_create(event_ctx, event_ctx);
if (c == NULL) return NULL;
- if (methods == NULL) {
+ if (ctx == NULL) {
composite_error(c, NT_STATUS_INVALID_PARAMETER);
return c;
}
@@ -147,8 +158,8 @@ struct composite_context *resolve_name_send(struct nbt_name *name, struct event_
c->status = nbt_name_dup(state, name, &state->name);
if (!composite_is_ok(c)) return c;
- state->methods = str_list_copy(state, methods);
- if (composite_nomem(state->methods, c)) return c;
+ state->ctx = talloc_reference(state, ctx);
+ if (composite_nomem(state->ctx, c)) return c;
if (is_ipaddress(state->name.name) ||
strcasecmp(state->name.name, "localhost") == 0) {
@@ -159,6 +170,7 @@ struct composite_context *resolve_name_send(struct nbt_name *name, struct event_
return c;
}
+ state->method = ctx->methods;
state->creq = setup_next_method(c);
if (composite_nomem(state->creq, c)) return c;
@@ -187,9 +199,9 @@ NTSTATUS resolve_name_recv(struct composite_context *c,
/*
general name resolution - sync call
*/
-NTSTATUS resolve_name(struct nbt_name *name, TALLOC_CTX *mem_ctx, const char **reply_addr, struct event_context *ev, const char **name_resolve_order)
+NTSTATUS resolve_name(struct resolve_context *ctx, struct nbt_name *name, TALLOC_CTX *mem_ctx, const char **reply_addr, struct event_context *ev)
{
- struct composite_context *c = resolve_name_send(name, ev, name_resolve_order);
+ struct composite_context *c = resolve_name_send(ctx, name, ev);
return resolve_name_recv(c, mem_ctx, reply_addr);
}
@@ -215,3 +227,27 @@ void make_nbt_name_server(struct nbt_name *nbt, const char *name)
{
make_nbt_name(nbt, name, NBT_NAME_SERVER);
}
+
+struct resolve_context *lp_resolve_context(struct loadparm_context *lp_ctx)
+{
+ const char **methods = lp_name_resolve_order(lp_ctx);
+ int i;
+ struct resolve_context *ret = resolve_context_init(lp_ctx);
+
+ if (ret == NULL)
+ return NULL;
+
+ for (i = 0; methods != NULL && methods[i] != NULL; i++) {
+ if (!strcmp(methods[i], "wins")) {
+ resolve_context_add_wins_method(ret, lp_wins_server_list(lp_ctx));
+ } else if (!strcmp(methods[i], "bcast")) {
+ resolve_context_add_bcast_method(ret);
+ } else if (!strcmp(methods[i], "host")) {
+ resolve_context_add_host_method(ret);
+ } else {
+ DEBUG(0, ("Unknown resolve method '%s'", methods[i]));
+ }
+ }
+
+ return ret;
+}
diff --git a/source4/libcli/resolve/resolve.h b/source4/libcli/resolve/resolve.h
index 72db3839a2..73cb78c124 100644
--- a/source4/libcli/resolve/resolve.h
+++ b/source4/libcli/resolve/resolve.h
@@ -23,6 +23,8 @@
#define __RESOLVE_H__
#include "libcli/nbt/libnbt.h"
+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"
#endif /* __RESOLVE_H__ */
diff --git a/source4/libcli/resolve/testsuite.c b/source4/libcli/resolve/testsuite.c
index b87b59b81a..73a8c841bb 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) {
const char *s;
- struct composite_context *c = resolve_name_host_send(mem_ctx, ev, &n);
+ struct composite_context *c = resolve_name_host_send(mem_ctx, ev, NULL, &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 2cbcd5f483..73b9413eb4 100644
--- a/source4/libcli/resolve/wins.c
+++ b/source4/libcli/resolve/wins.c
@@ -24,17 +24,22 @@
#include "libcli/resolve/resolve.h"
#include "param/param.h"
-/*
+struct resolve_wins_data {
+ const char **address_list;
+};
+
+/**
wins name resolution method - async send
*/
struct composite_context *resolve_name_wins_send(
TALLOC_CTX *mem_ctx,
struct event_context *event_ctx,
+ void *userdata,
struct nbt_name *name)
{
- const char **address_list = lp_wins_server_list(global_loadparm);
- if (address_list == NULL) return NULL;
- return resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, false, true);
+ 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, false, true);
}
/*
@@ -51,9 +56,20 @@ NTSTATUS resolve_name_wins_recv(struct composite_context *c,
*/
NTSTATUS resolve_name_wins(struct nbt_name *name,
TALLOC_CTX *mem_ctx,
+ const char **address_list,
const char **reply_addr)
{
- struct composite_context *c = resolve_name_wins_send(mem_ctx, NULL, name);
+ struct composite_context *c;
+ struct resolve_wins_data *wins_data = talloc(mem_ctx, struct resolve_wins_data);
+ wins_data->address_list = address_list;
+ 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 resolve_wins_data *wins_data = talloc(ctx, struct resolve_wins_data);
+ wins_data->address_list = str_list_copy(wins_data, address_list);
+ return resolve_context_add_method(ctx, resolve_name_wins_send, resolve_name_wins_recv,
+ wins_data);
+}
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index 39bb992d11..8b75e125b0 100644
--- a/source4/libcli/smb2/connect.c
+++ b/source4/libcli/smb2/connect.c
@@ -163,7 +163,7 @@ static void continue_resolve(struct composite_context *creq)
struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx,
const char *host,
const char *share,
- const char **name_resolve_order,
+ struct resolve_context *resolve_ctx,
struct cli_credentials *credentials,
struct event_context *ev)
{
@@ -188,7 +188,7 @@ struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx,
ZERO_STRUCT(name);
name.name = host;
- creq = resolve_name_send(&name, c->event_ctx, name_resolve_order);
+ creq = resolve_name_send(resolve_ctx, &name, c->event_ctx);
composite_continue(c, creq, continue_resolve, c);
return c;
}
@@ -215,13 +215,13 @@ NTSTATUS smb2_connect_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
*/
NTSTATUS smb2_connect(TALLOC_CTX *mem_ctx,
const char *host, const char *share,
- const char **name_resolve_order,
+ struct resolve_context *resolve_ctx,
struct cli_credentials *credentials,
struct smb2_tree **tree,
struct event_context *ev)
{
struct composite_context *c = smb2_connect_send(mem_ctx, host, share,
- name_resolve_order,
+ resolve_ctx,
credentials, ev);
return smb2_connect_recv(c, mem_ctx, tree);
}
diff --git a/source4/libcli/smb2/smb2_calls.h b/source4/libcli/smb2/smb2_calls.h
index 318a634ac4..6a551da4ae 100644
--- a/source4/libcli/smb2/smb2_calls.h
+++ b/source4/libcli/smb2/smb2_calls.h
@@ -95,4 +95,5 @@ struct smb2_setinfo {
struct cli_credentials;
struct event_context;
+struct resolve_context;
#include "libcli/smb2/smb2_proto.h"
diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c
index 9579cd20b5..1a8262c76a 100644
--- a/source4/libcli/smb_composite/connect.c
+++ b/source4/libcli/smb_composite/connect.c
@@ -463,8 +463,7 @@ struct composite_context *smb_composite_connect_send(struct smb_composite_connec
state->stage = CONNECT_RESOLVE;
make_nbt_name_server(&name, io->in.dest_host);
- state->creq = resolve_name_send(&name, c->event_ctx,
- lp_name_resolve_order(global_loadparm));
+ state->creq = resolve_name_send(lp_resolve_context(global_loadparm), &name, c->event_ctx);
if (state->creq == NULL) goto failed;
state->creq->async.private_data = c;
diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c
index 9f7bd91ec9..00346c45a4 100644
--- a/source4/libcli/wrepl/winsrepl.c
+++ b/source4/libcli/wrepl/winsrepl.c
@@ -30,6 +30,7 @@
#include "system/network.h"
#include "lib/socket/netif.h"
#include "param/param.h"
+#include "libcli/resolve/resolve.h"
static struct wrepl_request *wrepl_request_finished(struct wrepl_request *req, NTSTATUS status);
@@ -343,7 +344,7 @@ struct composite_context *wrepl_connect_send(struct wrepl_socket *wrepl_socket,
if (composite_nomem(peer, result)) return result;
state->creq = socket_connect_send(wrepl_socket->sock, us, peer,
- 0, lp_name_resolve_order(global_loadparm),
+ 0, lp_resolve_context(global_loadparm),
wrepl_socket->event.ctx);
composite_continue(result, state->creq, wrepl_connect_handler, state);
return result;
diff --git a/source4/libnet/libnet.c b/source4/libnet/libnet.c
index 5c483a757c..d1605bc17d 100644
--- a/source4/libnet/libnet.c
+++ b/source4/libnet/libnet.c
@@ -21,6 +21,7 @@
#include "libnet/libnet.h"
#include "lib/events/events.h"
#include "param/param.h"
+#include "libcli/resolve/resolve.h"
struct libnet_context *libnet_context_init(struct event_context *ev,
struct loadparm_context *lp_ctx)
@@ -45,7 +46,7 @@ struct libnet_context *libnet_context_init(struct event_context *ev,
ctx->lp_ctx = lp_ctx;
/* name resolution methods */
- ctx->name_res_methods = str_list_copy(ctx, lp_name_resolve_order(lp_ctx));
+ ctx->resolve_ctx = lp_resolve_context(lp_ctx);
/* connected services' params */
ZERO_STRUCT(ctx->samr);
diff --git a/source4/libnet/libnet.h b/source4/libnet/libnet.h
index 4f3acc6010..71ee8ef8e4 100644
--- a/source4/libnet/libnet.h
+++ b/source4/libnet/libnet.h
@@ -47,7 +47,7 @@ struct libnet_context {
} lsa;
/* name resolution methods */
- const char **name_res_methods;
+ struct resolve_context *resolve_ctx;
struct event_context *event_ctx;
diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c
index fcb24601e4..b8c6609d8e 100644
--- a/source4/libnet/libnet_lookup.c
+++ b/source4/libnet/libnet_lookup.c
@@ -57,7 +57,7 @@ struct composite_context *libnet_Lookup_send(struct libnet_context *ctx,
struct composite_context *c;
struct lookup_state *s;
struct composite_context *cresolve_req;
- const char** methods;
+ struct resolve_context *resolve_ctx;
/* allocate context and state structures */
c = composite_create(ctx, ctx->event_ctx);
@@ -81,14 +81,14 @@ struct composite_context *libnet_Lookup_send(struct libnet_context *ctx,
s->hostname.scope = NULL;
/* name resolution methods */
- if (io->in.methods) {
- methods = io->in.methods;
+ if (io->in.resolve_ctx) {
+ resolve_ctx = io->in.resolve_ctx;
} else {
- methods = ctx->name_res_methods;
+ resolve_ctx = ctx->resolve_ctx;
}
/* send resolve request */
- cresolve_req = resolve_name_send(&s->hostname, c->event_ctx, methods);
+ cresolve_req = resolve_name_send(resolve_ctx, &s->hostname, c->event_ctx);
if (composite_nomem(cresolve_req, c)) return c;
composite_continue(c, cresolve_req, continue_name_resolved, c);
@@ -196,7 +196,7 @@ struct composite_context* libnet_LookupDCs_send(struct libnet_context *ctx,
c = finddcs_send(mem_ctx, lp_netbios_name(ctx->lp_ctx),
io->in.domain_name, io->in.name_type,
- NULL, ctx->name_res_methods, ctx->event_ctx, msg_ctx);
+ NULL, ctx->resolve_ctx, ctx->event_ctx, msg_ctx);
return c;
}
diff --git a/source4/libnet/libnet_lookup.h b/source4/libnet/libnet_lookup.h
index 69cc0b5ade..189ae58b39 100644
--- a/source4/libnet/libnet_lookup.h
+++ b/source4/libnet/libnet_lookup.h
@@ -22,7 +22,7 @@ struct libnet_Lookup {
struct {
const char *hostname;
int type;
- const char **methods;
+ struct resolve_context *resolve_ctx;
} in;
struct {
const char **address;
diff --git a/source4/libnet/libnet_site.c b/source4/libnet/libnet_site.c
index 9351aef634..08cedf0d95 100644
--- a/source4/libnet/libnet_site.c
+++ b/source4/libnet/libnet_site.c
@@ -147,7 +147,7 @@ NTSTATUS libnet_JoinSite(struct ldb_context *remote_ldb,
}
make_nbt_name_client(&name, libnet_r->out.samr_binding->host);
- status = resolve_name(&name, r, &dest_addr, NULL, lp_name_resolve_order(global_loadparm));
+ status = resolve_name(lp_resolve_context(global_loadparm), &name, r, &dest_addr, NULL);
if (!NT_STATUS_IS_OK(status)) {
libnet_r->out.error_string = NULL;
talloc_free(tmp_ctx);
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h
index ff827e50f2..9936ebe001 100644
--- a/source4/librpc/rpc/dcerpc.h
+++ b/source4/librpc/rpc/dcerpc.h
@@ -177,7 +177,7 @@ struct dcerpc_pipe_connect {
const char *pipe_name;
const struct ndr_interface_table *interface;
struct cli_credentials *creds;
- const char **name_resolve_order;
+ struct resolve_context *resolve_ctx;
};
diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c
index e6244fe229..a7c26f2f93 100644
--- a/source4/librpc/rpc/dcerpc_connect.c
+++ b/source4/librpc/rpc/dcerpc_connect.c
@@ -32,6 +32,7 @@
#include "librpc/rpc/dcerpc.h"
#include "auth/credentials/credentials.h"
#include "param/param.h"
+#include "libcli/resolve/resolve.h"
struct pipe_np_smb_state {
@@ -236,7 +237,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(
/* send smb2 connect request */
conn_req = smb2_connect_send(mem_ctx, s->io.binding->host, "IPC$",
- s->io.name_resolve_order,
+ s->io.resolve_ctx,
s->io.creds,
c->event_ctx);
composite_continue(c, conn_req, continue_smb2_connect, c);
@@ -308,7 +309,7 @@ static struct composite_context* dcerpc_pipe_connect_ncacn_ip_tcp_send(TALLOC_CT
/* send pipe open request on tcp/ip */
pipe_req = dcerpc_pipe_open_tcp_send(s->io.pipe->conn, s->host, s->target_hostname,
- s->port, io->name_resolve_order);
+ s->port, io->resolve_ctx);
composite_continue(c, pipe_req, continue_pipe_open_ncacn_ip_tcp, c);
return c;
}
@@ -521,7 +522,7 @@ static void continue_connect(struct composite_context *c, struct pipe_connect_st
pc.binding = s->binding;
pc.interface = s->table;
pc.creds = s->credentials;
- pc.name_resolve_order = lp_name_resolve_order(global_loadparm);
+ pc.resolve_ctx = lp_resolve_context(global_loadparm);
/* connect dcerpc pipe depending on required transport */
switch (s->binding->transport) {
diff --git a/source4/librpc/rpc/dcerpc_secondary.c b/source4/librpc/rpc/dcerpc_secondary.c
index 0aa38d55ed..5e8dd955d3 100644
--- a/source4/librpc/rpc/dcerpc_secondary.c
+++ b/source4/librpc/rpc/dcerpc_secondary.c
@@ -29,6 +29,7 @@
#include "librpc/rpc/dcerpc.h"
#include "auth/credentials/credentials.h"
#include "param/param.h"
+#include "libcli/resolve/resolve.h"
struct sec_conn_state {
@@ -93,7 +94,7 @@ struct composite_context* dcerpc_secondary_connection_send(struct dcerpc_pipe *p
s->binding->host,
s->binding->target_hostname,
atoi(s->binding->endpoint),
- lp_name_resolve_order(global_loadparm));
+ lp_resolve_context(global_loadparm));
composite_continue(c, pipe_tcp_req, continue_open_tcp, c);
return c;
diff --git a/source4/librpc/rpc/dcerpc_sock.c b/source4/librpc/rpc/dcerpc_sock.c
index 327b1bf419..2e5a8388a1 100644
--- a/source4/librpc/rpc/dcerpc_sock.c
+++ b/source4/librpc/rpc/dcerpc_sock.c
@@ -332,7 +332,8 @@ static struct composite_context *dcerpc_pipe_open_socket_send(TALLOC_CTX *mem_ct
talloc_steal(s->sock, s->socket_ctx);
- conn_req = socket_connect_send(s->socket_ctx, NULL, s->server, 0, lp_name_resolve_order(global_loadparm),
+ conn_req = socket_connect_send(s->socket_ctx, NULL, s->server, 0,
+ lp_resolve_context(global_loadparm),
c->event_ctx);
composite_continue(c, conn_req, continue_socket_connect, c);
return c;
@@ -454,7 +455,7 @@ struct composite_context* dcerpc_pipe_open_tcp_send(struct dcerpc_connection *co
const char *server,
const char *target_hostname,
uint32_t port,
- const char **name_resolve_order)
+ struct resolve_context *resolve_ctx)
{
struct composite_context *c;
struct pipe_tcp_state *s;
@@ -480,7 +481,7 @@ struct composite_context* dcerpc_pipe_open_tcp_send(struct dcerpc_connection *co
s->conn = conn;
make_nbt_name_server(&name, server);
- resolve_req = resolve_name_send(&name, c->event_ctx, name_resolve_order);
+ resolve_req = resolve_name_send(resolve_ctx, &name, c->event_ctx);
composite_continue(c, resolve_req, continue_ip_resolve_name, c);
return c;
}
diff --git a/source4/scripting/ejs/smbcalls_nbt.c b/source4/scripting/ejs/smbcalls_nbt.c
index 5eaf458f34..c3679b1ec7 100644
--- a/source4/scripting/ejs/smbcalls_nbt.c
+++ b/source4/scripting/ejs/smbcalls_nbt.c
@@ -70,7 +70,7 @@ static int ejs_resolve_name(MprVarHandle eid, int argc, struct MprVar **argv)
result = 0;
- nt_status = resolve_name(&name, tmp_ctx, &reply_addr, event_context_find(tmp_ctx), lp_name_resolve_order(global_loadparm));
+ nt_status = resolve_name(lp_resolve_context(global_loadparm), &name, tmp_ctx, &reply_addr, event_context_find(tmp_ctx));
if (NT_STATUS_IS_OK(nt_status)) {
mprSetPropertyValue(argv[0], "value", mprString(reply_addr));
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
index 24c0d292ac..6f02fc4fe5 100644
--- a/source4/torture/basic/base.c
+++ b/source4/torture/basic/base.c
@@ -51,7 +51,7 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx)
goto failed;
}
- if (!smbcli_socket_connect(cli, host, lp_name_resolve_order(tctx->lp_ctx), lp_max_xmit(tctx->lp_ctx), lp_maxmux(tctx->lp_ctx))) {
+ if (!smbcli_socket_connect(cli, host, lp_resolve_context(tctx->lp_ctx), lp_max_xmit(tctx->lp_ctx), lp_maxmux(tctx->lp_ctx))) {
torture_comment(tctx, "Failed to connect with %s\n", host);
goto failed;
}
diff --git a/source4/torture/ldap/cldapbench.c b/source4/torture/ldap/cldapbench.c
index 47b1348ef6..c57ed6d48a 100644
--- a/source4/torture/ldap/cldapbench.c
+++ b/source4/torture/ldap/cldapbench.c
@@ -116,7 +116,7 @@ bool torture_bench_cldap(struct torture_context *torture)
make_nbt_name_server(&name, torture_setting_string(torture, "host", NULL));
/* do an initial name resolution to find its IP */
- status = resolve_name(&name, torture, &address, event_context_find(torture), lp_name_resolve_order(torture->lp_ctx));
+ status = resolve_name(lp_resolve_context(torture->lp_ctx), &name, torture, &address, event_context_find(torture));
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to resolve %s - %s\n",
name.name, nt_errstr(status));
diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c
index e4473b0fdd..bf3c77fb44 100644
--- a/source4/torture/libnet/libnet_lookup.c
+++ b/source4/torture/libnet/libnet_lookup.c
@@ -52,7 +52,7 @@ bool torture_lookup(struct torture_context *torture)
}
lookup.in.type = NBT_NAME_CLIENT;
- lookup.in.methods = NULL;
+ lookup.in.resolve_ctx = NULL;
lookup.out.address = NULL;
status = libnet_Lookup(ctx, mem_ctx, &lookup);
@@ -95,7 +95,7 @@ bool torture_lookup_host(struct torture_context *torture)
}
}
- lookup.in.methods = NULL;
+ lookup.in.resolve_ctx = NULL;
lookup.out.address = NULL;
status = libnet_LookupHost(ctx, mem_ctx, &lookup);
diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c
index bc3aa5dd57..37d445cac4 100644
--- a/source4/torture/nbt/dgram.c
+++ b/source4/torture/nbt/dgram.c
@@ -84,7 +84,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(&name, tctx, &address, event_context_find(tctx), lp_name_resolve_order(tctx->lp_ctx)),
+ resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
myaddress = talloc_strdup(dgmsock, iface_best_ip(tctx->lp_ctx, address));
@@ -163,7 +163,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(&name, tctx, &address, event_context_find(tctx), lp_name_resolve_order(tctx->lp_ctx)),
+ resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
myaddress = talloc_strdup(dgmsock, iface_best_ip(tctx->lp_ctx, address));
@@ -272,7 +272,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(&name, tctx, &address, event_context_find(tctx), lp_name_resolve_order(tctx->lp_ctx)),
+ resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
myaddress = talloc_strdup(dgmsock, iface_best_ip(tctx->lp_ctx, address));
diff --git a/source4/torture/nbt/nbt.c b/source4/torture/nbt/nbt.c
index 7cf2a48c4e..6cb9507398 100644
--- a/source4/torture/nbt/nbt.c
+++ b/source4/torture/nbt/nbt.c
@@ -34,7 +34,7 @@ bool torture_nbt_get_name(struct torture_context *tctx,
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(name, tctx, address, NULL, lp_name_resolve_order(tctx->lp_ctx)),
+ resolve_name(lp_resolve_context(tctx->lp_ctx), name, tctx, address, NULL),
talloc_asprintf(tctx,
"Failed to resolve %s", name->name));
diff --git a/source4/torture/smb2/scan.c b/source4/torture/smb2/scan.c
index 1ec67492bf..84be11c047 100644
--- a/source4/torture/smb2/scan.c
+++ b/source4/torture/smb2/scan.c
@@ -26,6 +26,7 @@
#include "lib/events/events.h"
#include "torture/torture.h"
#include "param/param.h"
+#include "libcli/resolve/resolve.h"
#include "torture/smb2/proto.h"
@@ -201,7 +202,7 @@ bool torture_smb2_scan(struct torture_context *torture)
struct smb2_request *req;
status = smb2_connect(mem_ctx, host, share,
- lp_name_resolve_order(torture->lp_ctx),
+ lp_resolve_context(torture->lp_ctx),
credentials, &tree,
event_context_find(mem_ctx));
if (!NT_STATUS_IS_OK(status)) {
@@ -218,7 +219,7 @@ bool torture_smb2_scan(struct torture_context *torture)
if (!smb2_request_receive(req)) {
talloc_free(tree);
status = smb2_connect(mem_ctx, host, share,
- lp_name_resolve_order(torture->lp_ctx),
+ lp_resolve_context(torture->lp_ctx),
credentials, &tree,
event_context_find(mem_ctx));
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c
index 3170b0073d..fe88296a32 100644
--- a/source4/torture/smb2/util.c
+++ b/source4/torture/smb2/util.c
@@ -27,6 +27,7 @@
#include "system/time.h"
#include "librpc/gen_ndr/ndr_security.h"
#include "param/param.h"
+#include "libcli/resolve/resolve.h"
#include "torture/torture.h"
#include "torture/smb2/proto.h"
@@ -310,7 +311,7 @@ bool torture_smb2_connection(struct torture_context *tctx, struct smb2_tree **tr
struct cli_credentials *credentials = cmdline_credentials;
status = smb2_connect(tctx, host, share,
- lp_name_resolve_order(tctx->lp_ctx),
+ lp_resolve_context(tctx->lp_ctx),
credentials, tree,
event_context_find(tctx));
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/winbind/wb_dom_info.c b/source4/winbind/wb_dom_info.c
index e53e3d827b..05b63e67c8 100644
--- a/source4/winbind/wb_dom_info.c
+++ b/source4/winbind/wb_dom_info.c
@@ -70,7 +70,7 @@ struct composite_context *wb_get_dom_info_send(TALLOC_CTX *mem_ctx,
ctx = finddcs_send(mem_ctx, lp_netbios_name(service->task->lp_ctx),
domain_name, NBT_NAME_LOGON,
dom_sid,
- lp_name_resolve_order(service->task->lp_ctx),
+ lp_resolve_context(service->task->lp_ctx),
service->task->event_ctx,
service->task->msg_ctx);
if (ctx == NULL) goto failed;
diff --git a/source4/winbind/wb_dom_info_trusted.c b/source4/winbind/wb_dom_info_trusted.c
index 5d960cb1d4..46d3bf37f6 100644
--- a/source4/winbind/wb_dom_info_trusted.c
+++ b/source4/winbind/wb_dom_info_trusted.c
@@ -192,8 +192,8 @@ static void trusted_dom_info_recv_dcname(struct rpc_request *req)
if (*state->info->dcs[0].name == '\\') state->info->dcs[0].name++;
make_nbt_name(&name, state->info->dcs[0].name, 0x20);
- ctx = resolve_name_send(&name, state->service->task->event_ctx,
- lp_name_resolve_order(state->service->task->lp_ctx));
+ ctx = resolve_name_send(lp_resolve_context(state->service->task->lp_ctx),
+ &name, state->service->task->event_ctx);
composite_continue(state->ctx, ctx, trusted_dom_info_recv_dcaddr,
state);