Author: tridge
Date: 2005-08-28 02:37:38 +0000 (Sun, 28 Aug 2005)
New Revision: 9704

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9704

Log:
 [EMAIL PROTECTED]:  tridge | 2005-08-27 19:38:31 +1000
 don't try to call the name resolver on non-ipv4 names!
 

Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/lib/socket/connect.c
   branches/SAMBA_4_0/source/lib/socket/socket.h
   branches/SAMBA_4_0/source/lib/socket/socket_ipv4.c
   branches/SAMBA_4_0/source/lib/socket/socket_ipv6.c
   branches/SAMBA_4_0/source/lib/socket/socket_unix.c


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: svk:merge
   - a953eb74-4aff-0310-a63c-855d20285ebb:/local/samba4:9683
   + a953eb74-4aff-0310-a63c-855d20285ebb:/local/samba4:9684

Modified: branches/SAMBA_4_0/source/lib/socket/connect.c
===================================================================
--- branches/SAMBA_4_0/source/lib/socket/connect.c      2005-08-28 02:37:27 UTC 
(rev 9703)
+++ branches/SAMBA_4_0/source/lib/socket/connect.c      2005-08-28 02:37:38 UTC 
(rev 9704)
@@ -74,15 +74,20 @@
 {
        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);

Modified: branches/SAMBA_4_0/source/lib/socket/socket.h
===================================================================
--- branches/SAMBA_4_0/source/lib/socket/socket.h       2005-08-28 02:37:27 UTC 
(rev 9703)
+++ branches/SAMBA_4_0/source/lib/socket/socket.h       2005-08-28 02:37:38 UTC 
(rev 9704)
@@ -102,6 +102,7 @@
 
        void *private_data;
        const struct socket_ops *ops;
+       const char *backend_name;
 };
 
 

Modified: branches/SAMBA_4_0/source/lib/socket/socket_ipv4.c
===================================================================
--- branches/SAMBA_4_0/source/lib/socket/socket_ipv4.c  2005-08-28 02:37:27 UTC 
(rev 9703)
+++ branches/SAMBA_4_0/source/lib/socket/socket_ipv4.c  2005-08-28 02:37:38 UTC 
(rev 9704)
@@ -46,6 +46,8 @@
                return map_nt_error_from_unix(errno);
        }
 
+       sock->backend_name = "ipv4";
+
        return NT_STATUS_OK;
 }
 

Modified: branches/SAMBA_4_0/source/lib/socket/socket_ipv6.c
===================================================================
--- branches/SAMBA_4_0/source/lib/socket/socket_ipv6.c  2005-08-28 02:37:27 UTC 
(rev 9703)
+++ branches/SAMBA_4_0/source/lib/socket/socket_ipv6.c  2005-08-28 02:37:38 UTC 
(rev 9704)
@@ -44,6 +44,8 @@
                return map_nt_error_from_unix(errno);
        }
 
+       sock->backend_name = "ipv6";
+
        return NT_STATUS_OK;
 }
 

Modified: branches/SAMBA_4_0/source/lib/socket/socket_unix.c
===================================================================
--- branches/SAMBA_4_0/source/lib/socket/socket_unix.c  2005-08-28 02:37:27 UTC 
(rev 9703)
+++ branches/SAMBA_4_0/source/lib/socket/socket_unix.c  2005-08-28 02:37:38 UTC 
(rev 9704)
@@ -57,6 +57,8 @@
        }
        sock->private_data = NULL;
 
+       sock->backend_name = "unix";
+
        return NT_STATUS_OK;
 }
 

Reply via email to