Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1bcbe865
Commit
1bcbe865
authored
Apr 24, 2008
by
Kai Blin
Committed by
Alexandre Julliard
Apr 24, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Work around the host name resolving to 127.x.x.x when using that for binding.
parent
9359ff6f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
socket.c
dlls/ws2_32/socket.c
+22
-1
No files found.
dlls/ws2_32/socket.c
View file @
1bcbe865
...
...
@@ -3,7 +3,7 @@
*
* Copyright (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka.
* Copyright (C) 2005 Marcus Meissner
* Copyright (C) 2006 Kai Blin
* Copyright (C) 2006
-2008
Kai Blin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -359,6 +359,8 @@ static const int ws_eai_map[][2] =
{
0
,
0
}
};
static
const
char
magic_loopback_addr
[]
=
{
127
,
12
,
34
,
56
};
static
inline
DWORD
NtStatusToWSAError
(
const
DWORD
status
)
{
/* We only need to cover the status codes set by server async request handling */
...
...
@@ -1427,6 +1429,18 @@ int WINAPI WS_bind(SOCKET s, const struct WS_sockaddr* name, int namelen)
}
}
#endif
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 bind to the default host interface, using
* INADDR_ANY instead*/
WARN
(
"Trying to bind to magic IP address, using "
"INADDR_ANY instead.
\n
"
);
in4
->
sin_addr
.
s_addr
=
htonl
(
WS_INADDR_ANY
);
}
}
if
(
bind
(
fd
,
&
uaddr
.
addr
,
uaddrlen
)
<
0
)
{
int
loc_errno
=
errno
;
...
...
@@ -3230,6 +3244,13 @@ struct WS_hostent* WINAPI WS_gethostbyname(const char* name)
#else
LeaveCriticalSection
(
&
csWSgetXXXbyYYY
);
#endif
if
(
retval
->
h_addr_list
[
0
][
0
]
==
127
&&
strcmp
(
name
,
"localhost"
)
!=
0
)
{
/* hostname != "localhost" but has loopback address. replace by our
* special address.*/
memcpy
(
retval
->
h_addr_list
[
0
],
magic_loopback_addr
,
4
);
}
TRACE
(
"%s ret %p
\n
"
,
debugstr_a
(
name
),
retval
);
return
retval
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment