r9704: r9684@blu: tridge | 2005-08-27 19:38:31 +1000
authorAndrew Tridgell <tridge@samba.org>
Sun, 28 Aug 2005 02:37:38 +0000 (02:37 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:34:52 +0000 (13:34 -0500)
 don't try to call the name resolver on non-ipv4 names!
(This used to be commit 4bb3d36fe6705bc625fe4122500f681ab7f2dc53)

source4/lib/socket/connect.c
source4/lib/socket/socket.h
source4/lib/socket/socket_ipv4.c
source4/lib/socket/socket_ipv6.c
source4/lib/socket/socket_unix.c

index 567c8f41d287127e6c856294634d571b419b572e..bb4d7cc84342b2e5b4e269af13036657ae146a11 100644 (file)
@@ -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);
index 8645ba28bc0825209291aa5e17ccedf0e2a452e0..27a1dfe04183b292926723db29b370606d92c4f5 100644 (file)
@@ -102,6 +102,7 @@ struct socket_context {
 
        void *private_data;
        const struct socket_ops *ops;
+       const char *backend_name;
 };
 
 
index 0fc65698c4cc1a6ca674916574312e36dc00326b..9c393a77ec31c35f3fe091ecb019318bc0306171 100644 (file)
@@ -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;
 }
 
index 58e35d87def4c2da258392e0f343dfd339e1f2e4..da3a69e81eaa260c1a1bbbe09a65d08829a58baf 100644 (file)
@@ -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;
 }
 
index 9c19aaace5d376a5ecd471df5d44593046f2d04b..c5af48da0fa1ead76c88dd544e243b5e54acfe26 100644 (file)
@@ -57,6 +57,8 @@ static NTSTATUS unixdom_init(struct socket_context *sock)
        }
        sock->private_data = NULL;
 
+       sock->backend_name = "unix";
+
        return NT_STATUS_OK;
 }