From 36d63105991abef1612433e18207624f2f9e429e Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Wed, 28 May 2008 10:24:12 +0200 Subject: [PATCH] ws2_32: Change back magic 127.12.34.56 to loopback on connect(). --- dlls/ws2_32/socket.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index ab573883695..889f88fb5e4 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -1492,6 +1492,19 @@ int WINAPI WS_connect(SOCKET s, const struct WS_sockaddr* name, int namelen) } else { + if (name->sa_family == WS_AF_INET) + { + struct sockaddr_in *in4 = (struct sockaddr_in*) &uaddr; + if (memcmp(&in4->sin_addr, &magic_loopback_addr, 4) == 0) + { + /* Trying to connect to magic replace-loopback address, + * assuming we really want to connect to localhost */ + TRACE("Trying to connect to magic IP address, using " + "INADDR_LOOPBACK instead.\n"); + in4->sin_addr.s_addr = htonl(WS_INADDR_LOOPBACK); + } + } + if (connect(fd, &uaddr.addr, uaddrlen) == 0) goto connect_success; }