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
a2053597
Commit
a2053597
authored
Aug 29, 2017
by
Stefan Dösinger
Committed by
Alexandre Julliard
Aug 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Also check the FQDN when injecting the local IP.
Signed-off-by:
Stefan Dösinger
<
stefan@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
72b92656
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
socket.c
dlls/ws2_32/socket.c
+16
-11
No files found.
dlls/ws2_32/socket.c
View file @
a2053597
...
...
@@ -6539,15 +6539,15 @@ static int convert_eai_u2w(int unixret) {
return
unixret
;
}
static
char
*
get_
hostname
(
void
)
static
char
*
get_
fqdn
(
void
)
{
char
*
ret
;
DWORD
size
=
0
;
GetComputerNameExA
(
ComputerNamePhysicalDns
Hostname
,
NULL
,
&
size
);
GetComputerNameExA
(
ComputerNamePhysicalDns
FullyQualified
,
NULL
,
&
size
);
if
(
GetLastError
()
!=
ERROR_MORE_DATA
)
return
NULL
;
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
return
NULL
;
if
(
!
GetComputerNameExA
(
ComputerNamePhysicalDns
Hostname
,
ret
,
&
size
))
if
(
!
GetComputerNameExA
(
ComputerNamePhysicalDns
FullyQualified
,
ret
,
&
size
))
{
HeapFree
(
GetProcessHeap
(),
0
,
ret
);
return
NULL
;
...
...
@@ -6564,8 +6564,9 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
struct
addrinfo
*
unixaires
=
NULL
;
int
result
;
struct
addrinfo
unixhints
,
*
punixhints
=
NULL
;
char
*
hostname
,
*
nodeV6
=
NULL
;
char
*
dot
,
*
nodeV6
=
NULL
,
*
fqdn
;
const
char
*
node
;
size_t
hostname_len
=
0
;
*
res
=
NULL
;
if
(
!
nodename
&&
!
servname
)
...
...
@@ -6574,13 +6575,16 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
return
WSAHOST_NOT_FOUND
;
}
hostname
=
get_hostname
();
if
(
!
hostname
)
return
WSA_NOT_ENOUGH_MEMORY
;
fqdn
=
get_fqdn
();
if
(
!
fqdn
)
return
WSA_NOT_ENOUGH_MEMORY
;
dot
=
strchr
(
fqdn
,
'.'
);
if
(
dot
)
hostname_len
=
dot
-
fqdn
;
if
(
!
nodename
)
node
=
NULL
;
else
if
(
!
nodename
[
0
])
node
=
hostname
;
node
=
fqdn
;
else
{
node
=
nodename
;
...
...
@@ -6595,7 +6599,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
nodeV6
=
HeapAlloc
(
GetProcessHeap
(),
0
,
close_bracket
-
node
);
if
(
!
nodeV6
)
{
HeapFree
(
GetProcessHeap
(),
0
,
hostname
);
HeapFree
(
GetProcessHeap
(),
0
,
fqdn
);
return
WSA_NOT_ENOUGH_MEMORY
;
}
lstrcpynA
(
nodeV6
,
node
+
1
,
close_bracket
-
node
);
...
...
@@ -6624,7 +6628,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
if
(
punixhints
->
ai_socktype
<
0
)
{
SetLastError
(
WSAESOCKTNOSUPPORT
);
HeapFree
(
GetProcessHeap
(),
0
,
hostname
);
HeapFree
(
GetProcessHeap
(),
0
,
fqdn
);
HeapFree
(
GetProcessHeap
(),
0
,
nodeV6
);
return
SOCKET_ERROR
;
}
...
...
@@ -6648,7 +6652,8 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
/* getaddrinfo(3) is thread safe, no need to wrap in CS */
result
=
getaddrinfo
(
node
,
servname
,
punixhints
,
&
unixaires
);
if
(
result
&&
(
!
hints
||
!
(
hints
->
ai_flags
&
WS_AI_NUMERICHOST
))
&&
!
strcmp
(
hostname
,
node
))
if
(
result
&&
(
!
hints
||
!
(
hints
->
ai_flags
&
WS_AI_NUMERICHOST
))
&&
(
!
strcmp
(
fqdn
,
node
)
||
(
!
strncmp
(
fqdn
,
node
,
hostname_len
)
&&
!
node
[
hostname_len
])))
{
/* If it didn't work it means the host name IP is not in /etc/hosts, try again
* by sending a NULL host and avoid sending a NULL servname too because that
...
...
@@ -6657,7 +6662,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
result
=
getaddrinfo
(
NULL
,
servname
?
servname
:
"0"
,
punixhints
,
&
unixaires
);
}
TRACE
(
"%s, %s %p -> %p %d
\n
"
,
debugstr_a
(
nodename
),
debugstr_a
(
servname
),
hints
,
res
,
result
);
HeapFree
(
GetProcessHeap
(),
0
,
hostname
);
HeapFree
(
GetProcessHeap
(),
0
,
fqdn
);
HeapFree
(
GetProcessHeap
(),
0
,
nodeV6
);
if
(
!
result
)
{
...
...
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