From f55ea8bb3dca868e21663cd90eaea7a35cd7886c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 9 Jan 2006 22:12:53 +0000 Subject: r12804: This patch reworks the Samba4 sockets layer to use a socket_address structure that is more generic than just 'IP/port'. It now passes make test, and has been reviewed and updated by metze. (Thankyou *very* much). This passes 'make test' as well as kerberos use (not currently in the testsuite). The original purpose of this patch was to have Samba able to pass a socket address stucture from the BSD layer into the kerberos routines and back again. It also removes nbt_peer_addr, which was being used for a similar purpose. It is a large change, but worthwhile I feel. Andrew Bartlett (This used to be commit 88198c4881d8620a37086f80e4da5a5b71c5bbb2) --- source4/lib/socket/connect_multi.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'source4/lib/socket/connect_multi.c') diff --git a/source4/lib/socket/connect_multi.c b/source4/lib/socket/connect_multi.c index 6a90ef9a05..7396435075 100644 --- a/source4/lib/socket/connect_multi.c +++ b/source4/lib/socket/connect_multi.c @@ -49,7 +49,7 @@ struct connect_multi_state { struct connect_one_state { struct composite_context *result; struct socket_context *sock; - uint16_t port; + struct socket_address *addr; }; static void continue_resolve_name(struct composite_context *creq); @@ -144,15 +144,18 @@ static void connect_multi_next_socket(struct composite_context *result) if (composite_nomem(state, result)) return; state->result = result; - state->port = multi->ports[next]; - result->status = socket_create("ipv4", SOCKET_TYPE_STREAM, &state->sock, 0); if (!composite_is_ok(result)) return; + /* Form up the particular address we are interested in */ + state->addr = socket_address_from_strings(state, state->sock->backend_name, + multi->server_address, multi->ports[next]); + if (composite_nomem(state->addr, result)) return; + talloc_steal(state, state->sock); - creq = socket_connect_send(state->sock, NULL, 0, - multi->server_address, state->port, 0, result->event_ctx); + creq = socket_connect_send(state->sock, NULL, + state->addr, 0, result->event_ctx); if (composite_nomem(creq, result)) return; talloc_steal(state, creq); @@ -220,7 +223,7 @@ static void continue_one(struct composite_context *creq) if (NT_STATUS_IS_OK(status)) { multi->sock = talloc_steal(multi, state->sock); - multi->result_port = state->port; + multi->result_port = state->addr->port; } talloc_free(state); -- cgit