summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-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
4 files changed, 19 insertions, 19 deletions
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);