Robert Shearman : rpcrt4: Don' t try to resolve the name when constructing a protocol tower.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Jun 3 05:24:36 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 0fad0895d7b5e49298f4488a1920aeb4a275ce61
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=0fad0895d7b5e49298f4488a1920aeb4a275ce61

Author: Robert Shearman <rob at codeweavers.com>
Date:   Fri Jun  2 20:46:29 2006 +0100

rpcrt4: Don't try to resolve the name when constructing a protocol tower.

Instead just fill it in with all zeros.

---

 dlls/rpcrt4/rpc_transport.c |   10 +++++++---
 dlls/rpcrt4/tests/rpc.c     |   10 ++++++++++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index 1a574d2..b50f839 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -584,7 +584,7 @@ static size_t rpcrt4_ncacn_ip_tcp_get_to
     ipv4_floor->protid = EPM_PROTOCOL_IP;
     ipv4_floor->count_rhs = sizeof(ipv4_floor->ipv4addr);
 
-    hints.ai_flags          = 0;
+    hints.ai_flags          = AI_NUMERICHOST;
     /* FIXME: only support IPv4 at the moment. how is IPv6 represented by the EPM? */
     hints.ai_family         = PF_INET;
     hints.ai_socktype       = SOCK_STREAM;
@@ -597,8 +597,12 @@ static size_t rpcrt4_ncacn_ip_tcp_get_to
     ret = getaddrinfo(networkaddr, endpoint, &hints, &ai);
     if (ret < 0)
     {
-        ERR("getaddrinfo failed: %s\n", gai_strerror(ret));
-        return 0;
+        ret = getaddrinfo("0.0.0.0", endpoint, &hints, &ai);
+        if (ret < 0)
+        {
+            ERR("getaddrinfo failed: %s\n", gai_strerror(ret));
+            return 0;
+        }
     }
 
     if (ai->ai_family == PF_INET)
diff --git a/dlls/rpcrt4/tests/rpc.c b/dlls/rpcrt4/tests/rpc.c
index 03dc792..e19844b 100644
--- a/dlls/rpcrt4/tests/rpc.c
+++ b/dlls/rpcrt4/tests/rpc.c
@@ -270,6 +270,16 @@ static void test_towers(void)
     ok(ret == RPC_S_OK, "TowerExplode failed with error %ld\n", ret);
 
     I_RpcFree(tower);
+
+    /* test the behaviour for ip_tcp with name instead of dotted IP notation */
+    ret = TowerConstruct(&mapi_if_id, &ndr_syntax, "ncacn_ip_tcp", "135", "localhost", &tower);
+    ok(ret == RPC_S_OK, "TowerConstruct failed with error %ld\n", ret);
+    ret = TowerExplode(tower, NULL, NULL, NULL, NULL, &address);
+    ok(ret == RPC_S_OK, "TowerExplode failed with error %ld\n", ret);
+    ok(!strcmp(address, "0.0.0.0"), "address was \"%s\" instead of \"0.0.0.0\"\n", address);
+
+    I_RpcFree(address);
+    I_RpcFree(tower);
 }
 
 START_TEST( rpc )




More information about the wine-cvs mailing list