diff options
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/socket/connect.c | 6 | ||||
-rw-r--r-- | source4/lib/socket/connect_multi.c | 11 | ||||
-rw-r--r-- | source4/lib/socket/socket.h | 7 | ||||
-rw-r--r-- | source4/lib/socket/testsuite.c | 3 |
4 files changed, 21 insertions, 6 deletions
diff --git a/source4/lib/socket/connect.c b/source4/lib/socket/connect.c index 4a30fa3b92..cad8967dab 100644 --- a/source4/lib/socket/connect.c +++ b/source4/lib/socket/connect.c @@ -85,6 +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 event_context *event_ctx) { struct composite_context *result; @@ -206,10 +207,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, struct event_context *ev) + uint32_t flags, const char **name_resolve_order, + struct event_context *ev) { struct composite_context *ctx; ctx = socket_connect_send(sock, my_address, - server_address, flags, ev); + server_address, flags, name_resolve_order, ev); return socket_connect_recv(ctx); } diff --git a/source4/lib/socket/connect_multi.c b/source4/lib/socket/connect_multi.c index 6d30141459..58ab673965 100644 --- a/source4/lib/socket/connect_multi.c +++ b/source4/lib/socket/connect_multi.c @@ -38,6 +38,8 @@ struct connect_multi_state { int num_ports; uint16_t *ports; + const char **name_resolve_order; + struct socket_context *sock; uint16_t result_port; @@ -68,6 +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 event_context *event_ctx) { struct composite_context *result; @@ -87,6 +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->ports = talloc_array(multi, uint16_t, multi->num_ports); if (composite_nomem(multi->ports, result)) goto failed; @@ -104,7 +108,7 @@ _PUBLIC_ struct composite_context *socket_connect_multi_send( struct composite_context *creq; make_nbt_name_client(&name, server_address); creq = resolve_name_send(&name, result->event_ctx, - lp_name_resolve_order(global_loadparm)); + name_resolve_order); if (composite_nomem(creq, result)) goto failed; composite_continue(result, creq, continue_resolve_name, result); return result; @@ -157,7 +161,8 @@ 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, result->event_ctx); + state->addr, 0, multi->name_resolve_order, + result->event_ctx); if (composite_nomem(creq, result)) return; talloc_steal(state, creq); @@ -264,6 +269,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 event_context *event_ctx, struct socket_context **result, uint16_t *result_port) @@ -271,6 +277,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, 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 7679db08a1..24bc5f1aac 100644 --- a/source4/lib/socket/socket.h +++ b/source4/lib/socket/socket.h @@ -178,17 +178,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 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, struct event_context *ev); + uint32_t flags, + const char **name_resolve_order, + 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 event_context *event_ctx); NTSTATUS socket_connect_multi_recv(struct composite_context *ctx, TALLOC_CTX *mem_ctx, @@ -196,6 +200,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 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 84132c62b8..dea740dbc8 100644 --- a/source4/lib/socket/testsuite.c +++ b/source4/lib/socket/testsuite.c @@ -25,6 +25,7 @@ #include "system/network.h" #include "lib/socket/netif.h" #include "torture/torture.h" +#include "param/param.h" /* basic testing of udp routines @@ -145,7 +146,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, ev); + status = socket_connect_ev(sock2, NULL, srv_addr, 0, lp_name_resolve_order(tctx->lp_ctx), ev); torture_assert_ntstatus_ok(tctx, status, "connect() on socket 2"); status = socket_accept(sock1, &sock3); |