summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-12-17 23:13:44 +0100
committerStefan Metzmacher <metze@samba.org>2008-12-18 13:32:51 +0100
commitfc31f2c5269fd405be96b9a036baf35a60141ccf (patch)
tree8e1a1a374fd892dcd4117e6dbf049b43bd3d0e13
parent4c2a113dd06ab2ba0b6faef781a7c21b4a2f3db0 (diff)
downloadsamba-fc31f2c5269fd405be96b9a036baf35a60141ccf.tar.gz
samba-fc31f2c5269fd405be96b9a036baf35a60141ccf.tar.bz2
samba-fc31f2c5269fd405be96b9a036baf35a60141ccf.zip
s4:lib/socket: socket_connect_send() and socket_connect_ev() should only wrok with addresses
metze
-rw-r--r--source4/auth/kerberos/krb5_init_context.c3
-rw-r--r--source4/lib/socket/connect.c41
-rw-r--r--source4/lib/socket/connect_multi.c5
-rw-r--r--source4/lib/socket/socket.h2
-rw-r--r--source4/lib/socket/testsuite.c2
-rw-r--r--source4/libcli/ldap/ldap_client.c2
-rw-r--r--source4/libcli/wrepl/winsrepl.c3
-rw-r--r--source4/librpc/rpc/dcerpc_sock.c2
8 files changed, 9 insertions, 51 deletions
diff --git a/source4/auth/kerberos/krb5_init_context.c b/source4/auth/kerberos/krb5_init_context.c
index 06db904130..ac12a498c6 100644
--- a/source4/auth/kerberos/krb5_init_context.c
+++ b/source4/auth/kerberos/krb5_init_context.c
@@ -272,8 +272,7 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
continue;
}
- status = socket_connect_ev(smb_krb5->sock, NULL, remote_addr, 0,
- NULL, ev);
+ status = socket_connect_ev(smb_krb5->sock, NULL, remote_addr, 0, ev);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(smb_krb5);
continue;
diff --git a/source4/lib/socket/connect.c b/source4/lib/socket/connect.c
index 409e19e7f5..d74a7b4833 100644
--- a/source4/lib/socket/connect.c
+++ b/source4/lib/socket/connect.c
@@ -25,7 +25,6 @@
#include "lib/socket/socket.h"
#include "lib/events/events.h"
#include "libcli/composite/composite.h"
-#include "libcli/resolve/resolve.h"
struct connect_state {
@@ -38,7 +37,6 @@ struct connect_state {
static void socket_connect_handler(struct event_context *ev,
struct fd_event *fde,
uint16_t flags, void *private);
-static void continue_resolve_name(struct composite_context *ctx);
/*
call the real socket_connect() call, and setup event handler
@@ -75,16 +73,13 @@ struct composite_context *socket_connect_send(struct socket_context *sock,
struct socket_address *my_address,
struct socket_address *server_address,
uint32_t flags,
- struct resolve_context *resolve_ctx,
struct event_context *event_ctx)
{
struct composite_context *result;
struct connect_state *state;
- result = talloc_zero(sock, struct composite_context);
+ result = composite_create(sock, event_ctx);
if (result == NULL) return NULL;
- result->state = COMPOSITE_STATE_IN_PROGRESS;
- result->event_ctx = event_ctx;
state = talloc_zero(result, struct connect_state);
if (composite_nomem(state, result)) return result;
@@ -113,16 +108,6 @@ struct composite_context *socket_connect_send(struct socket_context *sock,
set_blocking(socket_get_fd(sock), false);
- if (resolve_ctx != NULL && server_address->addr && strcmp(sock->backend_name, "ipv4") == 0) {
- struct nbt_name name;
- struct composite_context *creq;
- make_nbt_name_server(&name, server_address->addr);
- 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;
- }
-
socket_send_connect(result);
return result;
@@ -147,26 +132,6 @@ static void socket_connect_handler(struct event_context *ev,
}
/*
- recv name resolution reply then send the connect
-*/
-static void continue_resolve_name(struct composite_context *creq)
-{
- struct composite_context *result = talloc_get_type(creq->async.private_data,
- struct composite_context);
- struct connect_state *state = talloc_get_type(result->private_data, struct connect_state);
- const char *addr;
-
- result->status = resolve_name_recv(creq, state, &addr);
- if (!composite_is_ok(result)) return;
-
- state->server_address = socket_address_from_strings(state, state->sock->backend_name,
- addr, state->server_address->port);
- if (composite_nomem(state->server_address, result)) return;
-
- socket_send_connect(result);
-}
-
-/*
wait for a socket_connect_send() to finish
*/
NTSTATUS socket_connect_recv(struct composite_context *result)
@@ -183,11 +148,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 resolve_context *resolve_ctx,
+ uint32_t flags,
struct event_context *ev)
{
struct composite_context *ctx;
ctx = socket_connect_send(sock, my_address,
- server_address, flags, resolve_ctx, ev);
+ server_address, flags, ev);
return socket_connect_recv(ctx);
}
diff --git a/source4/lib/socket/connect_multi.c b/source4/lib/socket/connect_multi.c
index ad8637a597..14c475d0c3 100644
--- a/source4/lib/socket/connect_multi.c
+++ b/source4/lib/socket/connect_multi.c
@@ -37,8 +37,6 @@ struct connect_multi_state {
int num_ports;
uint16_t *ports;
- struct resolve_context *resolve_ctx;
-
struct socket_context *sock;
uint16_t result_port;
@@ -89,7 +87,6 @@ _PUBLIC_ struct composite_context *socket_connect_multi_send(
if (composite_nomem(multi->server_address, result)) goto failed;
multi->num_ports = num_server_ports;
- 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;
@@ -159,7 +156,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->resolve_ctx,
+ state->addr, 0,
result->event_ctx);
if (composite_nomem(creq, result)) return;
talloc_steal(state, creq);
diff --git a/source4/lib/socket/socket.h b/source4/lib/socket/socket.h
index 8b1b65db92..4741a67990 100644
--- a/source4/lib/socket/socket.h
+++ b/source4/lib/socket/socket.h
@@ -178,14 +178,12 @@ struct composite_context *socket_connect_send(struct socket_context *sock,
struct socket_address *my_address,
struct socket_address *server_address,
uint32_t flags,
- 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,
- struct resolve_context *resolve_ctx,
struct event_context *ev);
struct composite_context *socket_connect_multi_send(TALLOC_CTX *mem_ctx,
diff --git a/source4/lib/socket/testsuite.c b/source4/lib/socket/testsuite.c
index 2c25d8f491..0fae880ca0 100644
--- a/source4/lib/socket/testsuite.c
+++ b/source4/lib/socket/testsuite.c
@@ -152,7 +152,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, NULL, ev);
+ status = socket_connect_ev(sock2, NULL, srv_addr, 0, ev);
torture_assert_ntstatus_ok(tctx, status, "connect() on socket 2");
status = socket_accept(sock1, &sock3);
diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c
index 7f43e16c95..082f6fa3e4 100644
--- a/source4/libcli/ldap/ldap_client.c
+++ b/source4/libcli/ldap/ldap_client.c
@@ -358,7 +358,7 @@ _PUBLIC_ struct composite_context *ldap_connect_send(struct ldap_connection *con
}
ctx = socket_connect_send(conn->sock, NULL, unix_addr,
- 0, lp_resolve_context(conn->lp_ctx), conn->event.event_ctx);
+ 0, conn->event.event_ctx);
ctx->async.fn = ldap_connect_recv_unix_conn;
ctx->async.private_data = state;
return result;
diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c
index 039b4dfb08..930616d211 100644
--- a/source4/libcli/wrepl/winsrepl.c
+++ b/source4/libcli/wrepl/winsrepl.c
@@ -345,8 +345,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, NULL,
- wrepl_socket->event.ctx);
+ 0, wrepl_socket->event.ctx);
composite_continue(result, state->creq, wrepl_connect_handler, state);
return result;
}
diff --git a/source4/librpc/rpc/dcerpc_sock.c b/source4/librpc/rpc/dcerpc_sock.c
index f0b542dae1..3cc8421339 100644
--- a/source4/librpc/rpc/dcerpc_sock.c
+++ b/source4/librpc/rpc/dcerpc_sock.c
@@ -338,7 +338,7 @@ static struct composite_context *dcerpc_pipe_open_socket_send(TALLOC_CTX *mem_ct
s->sock->path = talloc_reference(s->sock, full_path);
conn_req = socket_connect_send(s->socket_ctx, NULL, s->server, 0,
- NULL, c->event_ctx);
+ c->event_ctx);
composite_continue(c, conn_req, continue_socket_connect, c);
return c;
}