Re: Wine: gethostbyname implementation in WS2_32 is buggy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 16, 2003 at 04:59:18PM +0100,   wrote:
> Hi,
> 
> I am not confident how this patch-submission bussiness
> works, so I will just quickly describe what's wrong
> and how to fix it.
> 
> The current implementation of gethostbyname in WS2_32
> (located in winsock/socket.c) doesn't handle a null
> string argument correctly.
> 
> According to MS definition of gethostbyname, when it
> receives a null argument, it should return the same
> result as if a call to gethostname was made. Currently
> Wine doesn't do this: it simply crashes.
> 
> Fix is simple: add something like:
> if (name == NULL) return __ws_gethostbyname(
> "localhost", WS_DUP_LINEAR );
Is this the way it's supposed to be handled?
I interpreted this (in my original patch I sent very recently) as
something like:

--- dlls/winsock/socket.c       13 May 2003 04:43:44 -0000      1.126
+++ dlls/winsock/socket.c       16 May 2003 20:00:28 -0000
@@ -2893,6 +2893,17 @@
     int ebufsize=1024;
     struct hostent hostentry;
     int locerr = ENOBUFS;
+    char local_name[256];
+
+    /* name == NULL means use the local host name */
+    if (name == NULL)
+    {
+        if (WS_gethostname(local_name, sizeof(local_name)) != 0)
+            return NULL;
+···············
+        name = local_name;
+    }
+····
     host = NULL;

Which way is the right one? First? Second? Both? :)

-- 
Help prevent Information Technology Fascism! - before it's too late...
http://www.againsttcpa.com


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux