summaryrefslogtreecommitdiff
path: root/source4/lib/socket
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-08-28 02:37:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:52 -0500
commit75c29073ce12723598e4e204ccb616cd52fa2c13 (patch)
tree6940325b186d1cd2637320dfde5bdc5f080bc1fa /source4/lib/socket
parentc9d937b7ebd372a91cbd94130e5995c76e155a0a (diff)
downloadsamba-75c29073ce12723598e4e204ccb616cd52fa2c13.tar.gz
samba-75c29073ce12723598e4e204ccb616cd52fa2c13.tar.bz2
samba-75c29073ce12723598e4e204ccb616cd52fa2c13.zip
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)
Diffstat (limited to 'source4/lib/socket')
-rw-r--r--source4/lib/socket/connect.c15
-rw-r--r--source4/lib/socket/socket.h1
-rw-r--r--source4/lib/socket/socket_ipv4.c2
-rw-r--r--source4/lib/socket/socket_ipv6.c2
-rw-r--r--source4/lib/socket/socket_unix.c2
5 files changed, 17 insertions, 5 deletions
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;
}