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
3fe0a31d
Commit
3fe0a31d
authored
Apr 17, 2014
by
Bruno Jesus
Committed by
Alexandre Julliard
Apr 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Convert the magic loopback address back to 127.0.0.1 in gethostbyaddr.
parent
76cd4d63
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
13 deletions
+22
-13
socket.c
dlls/ws2_32/socket.c
+22
-13
No files found.
dlls/ws2_32/socket.c
View file @
3fe0a31d
...
...
@@ -5085,31 +5085,40 @@ struct WS_hostent* WINAPI WS_gethostbyaddr(const char *addr, int len, int type)
struct
WS_hostent
*
retval
=
NULL
;
struct
hostent
*
host
;
int
unixtype
=
convert_af_w2u
(
type
);
const
char
*
paddr
=
addr
;
unsigned
long
loopback
;
#ifdef HAVE_LINUX_GETHOSTBYNAME_R_6
char
*
extrabuf
;
int
ebufsize
=
1024
;
int
ebufsize
=
1024
;
struct
hostent
hostentry
;
int
locerr
=
ENOBUFS
;
int
locerr
=
ENOBUFS
;
#endif
/* convert back the magic loopback address if necessary */
if
(
unixtype
==
AF_INET
&&
len
==
4
&&
!
memcmp
(
addr
,
magic_loopback_addr
,
4
))
{
loopback
=
htonl
(
INADDR_LOOPBACK
);
paddr
=
(
char
*
)
&
loopback
;
}
#ifdef HAVE_LINUX_GETHOSTBYNAME_R_6
host
=
NULL
;
extrabuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
ebufsize
)
;
while
(
extrabuf
)
{
int
res
=
gethostbyaddr_r
(
addr
,
len
,
unixtype
,
int
res
=
gethostbyaddr_r
(
p
addr
,
len
,
unixtype
,
&
hostentry
,
extrabuf
,
ebufsize
,
&
host
,
&
locerr
);
if
(
res
!=
ERANGE
)
break
;
if
(
res
!=
ERANGE
)
break
;
ebufsize
*=
2
;
extrabuf
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
extrabuf
,
ebufsize
)
;
}
if
(
!
host
)
SetLastError
((
locerr
<
0
)
?
wsaErrno
()
:
wsaHerrno
(
locerr
));
#else
EnterCriticalSection
(
&
csWSgetXXXbyYYY
);
host
=
gethostbyaddr
(
addr
,
len
,
unixtype
);
if
(
!
host
)
SetLastError
((
h_errno
<
0
)
?
wsaErrno
()
:
wsaHerrno
(
h_errno
));
#endif
if
(
host
!=
NULL
)
retval
=
WS_dup_he
(
host
);
#ifdef HAVE_LINUX_GETHOSTBYNAME_R_6
if
(
host
)
retval
=
WS_dup_he
(
host
);
else
SetLastError
((
locerr
<
0
)
?
wsaErrno
()
:
wsaHerrno
(
locerr
));
HeapFree
(
GetProcessHeap
(),
0
,
extrabuf
);
#else
EnterCriticalSection
(
&
csWSgetXXXbyYYY
);
host
=
gethostbyaddr
(
paddr
,
len
,
unixtype
);
if
(
host
)
retval
=
WS_dup_he
(
host
);
else
SetLastError
((
h_errno
<
0
)
?
wsaErrno
()
:
wsaHerrno
(
h_errno
));
LeaveCriticalSection
(
&
csWSgetXXXbyYYY
);
#endif
TRACE
(
"ptr %p, len %d, type %d ret %p
\n
"
,
addr
,
len
,
type
,
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