From 75c29073ce12723598e4e204ccb616cd52fa2c13 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 28 Aug 2005 02:37:38 +0000 Subject: r9704: r9684@blu: tridge | 2005-08-27 19:38:31 +1000 don't try to call the name resolver on non-ipv4 names! (This used to be commit 4bb3d36fe6705bc625fe4122500f681ab7f2dc53) --- source4/lib/socket/connect.c | 15 ++++++++++----- source4/lib/socket/socket.h | 1 + source4/lib/socket/socket_ipv4.c | 2 ++ source4/lib/socket/socket_ipv6.c | 2 ++ source4/lib/socket/socket_unix.c | 2 ++ 5 files changed, 17 insertions(+), 5 deletions(-) (limited to 'source4') diff --git a/source4/lib/socket/connect.c b/source4/lib/socket/connect.c index 567c8f41d2..bb4d7cc843 100644 --- a/source4/lib/socket/connect.c +++ b/source4/lib/socket/connect.c @@ -74,15 +74,20 @@ NTSTATUS socket_connect_ev(struct socket_context *sock, { TALLOC_CTX *tmp_ctx = talloc_new(sock); NTSTATUS status; - + /* we resolve separately to ensure that the name resolutions happens asynchronously + + the check for ipv4 is ugly, but how to do it better? We don't want + to try to resolve unix pathnames here */ - status = connect_resolve(tmp_ctx, server_address, ev, &server_address); - if (!NT_STATUS_IS_OK(status)) { - talloc_free(tmp_ctx); - return status; + if (strcmp(sock->backend_name, "ipv4") == 0) { + status = connect_resolve(tmp_ctx, server_address, ev, &server_address); + if (!NT_STATUS_IS_OK(status)) { + talloc_free(tmp_ctx); + return status; + } } set_blocking(socket_get_fd(sock), False); diff --git a/source4/lib/socket/socket.h b/source4/lib/socket/socket.h index 8645ba28bc..27a1dfe041 100644 --- a/source4/lib/socket/socket.h +++ b/source4/lib/socket/socket.h @@ -102,6 +102,7 @@ struct socket_context { void *private_data; const struct socket_ops *ops; + const char *backend_name; }; diff --git a/source4/lib/socket/socket_ipv4.c b/source4/lib/socket/socket_ipv4.c index 0fc65698c4..9c393a77ec 100644 --- a/source4/lib/socket/socket_ipv4.c +++ b/source4/lib/socket/socket_ipv4.c @@ -46,6 +46,8 @@ static NTSTATUS ipv4_init(struct socket_context *sock) return map_nt_error_from_unix(errno); } + sock->backend_name = "ipv4"; + return NT_STATUS_OK; } diff --git a/source4/lib/socket/socket_ipv6.c b/source4/lib/socket/socket_ipv6.c index 58e35d87de..da3a69e81e 100644 --- a/source4/lib/socket/socket_ipv6.c +++ b/source4/lib/socket/socket_ipv6.c @@ -44,6 +44,8 @@ static NTSTATUS ipv6_tcp_init(struct socket_context *sock) return map_nt_error_from_unix(errno); } + sock->backend_name = "ipv6"; + return NT_STATUS_OK; } diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c index 9c19aaace5..c5af48da0f 100644 --- a/source4/lib/socket/socket_unix.c +++ b/source4/lib/socket/socket_unix.c @@ -57,6 +57,8 @@ static NTSTATUS unixdom_init(struct socket_context *sock) } sock->private_data = NULL; + sock->backend_name = "unix"; + return NT_STATUS_OK; } -- cgit