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
9fff80d8
Commit
9fff80d8
authored
Sep 28, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Retrieve the FQDN only when necessary in getaddrinfo().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
690ff3db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
socket.c
dlls/ws2_32/socket.c
+19
-20
No files found.
dlls/ws2_32/socket.c
View file @
9fff80d8
...
@@ -6759,9 +6759,8 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
...
@@ -6759,9 +6759,8 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
struct
addrinfo
*
unixaires
=
NULL
;
struct
addrinfo
*
unixaires
=
NULL
;
int
result
;
int
result
;
struct
addrinfo
unixhints
,
*
punixhints
=
NULL
;
struct
addrinfo
unixhints
,
*
punixhints
=
NULL
;
char
*
dot
,
*
nodeV6
=
NULL
,
*
fqdn
;
char
*
nodeV6
=
NULL
,
*
fqdn
=
NULL
;
const
char
*
node
;
const
char
*
node
;
size_t
hostname_len
=
0
;
*
res
=
NULL
;
*
res
=
NULL
;
if
(
!
nodename
&&
!
servname
)
if
(
!
nodename
&&
!
servname
)
...
@@ -6770,16 +6769,13 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
...
@@ -6770,16 +6769,13 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
return
WSAHOST_NOT_FOUND
;
return
WSAHOST_NOT_FOUND
;
}
}
fqdn
=
get_fqdn
();
if
(
!
fqdn
)
return
WSA_NOT_ENOUGH_MEMORY
;
dot
=
strchr
(
fqdn
,
'.'
);
if
(
dot
)
hostname_len
=
dot
-
fqdn
;
if
(
!
nodename
)
if
(
!
nodename
)
node
=
NULL
;
node
=
NULL
;
else
if
(
!
nodename
[
0
])
else
if
(
!
nodename
[
0
])
{
if
(
!
(
fqdn
=
get_fqdn
()))
return
WSA_NOT_ENOUGH_MEMORY
;
node
=
fqdn
;
node
=
fqdn
;
}
else
else
{
{
node
=
nodename
;
node
=
nodename
;
...
@@ -6792,11 +6788,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
...
@@ -6792,11 +6788,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
if
(
node
[
0
]
==
'['
&&
(
close_bracket
=
strchr
(
node
+
1
,
']'
)))
if
(
node
[
0
]
==
'['
&&
(
close_bracket
=
strchr
(
node
+
1
,
']'
)))
{
{
nodeV6
=
HeapAlloc
(
GetProcessHeap
(),
0
,
close_bracket
-
node
);
nodeV6
=
HeapAlloc
(
GetProcessHeap
(),
0
,
close_bracket
-
node
);
if
(
!
nodeV6
)
if
(
!
nodeV6
)
return
WSA_NOT_ENOUGH_MEMORY
;
{
HeapFree
(
GetProcessHeap
(),
0
,
fqdn
);
return
WSA_NOT_ENOUGH_MEMORY
;
}
lstrcpynA
(
nodeV6
,
node
+
1
,
close_bracket
-
node
);
lstrcpynA
(
nodeV6
,
node
+
1
,
close_bracket
-
node
);
node
=
nodeV6
;
node
=
nodeV6
;
}
}
...
@@ -6847,14 +6839,21 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
...
@@ -6847,14 +6839,21 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
/* getaddrinfo(3) is thread safe, no need to wrap in CS */
/* getaddrinfo(3) is thread safe, no need to wrap in CS */
result
=
getaddrinfo
(
node
,
servname
,
punixhints
,
&
unixaires
);
result
=
getaddrinfo
(
node
,
servname
,
punixhints
,
&
unixaires
);
if
(
result
&&
(
!
hints
||
!
(
hints
->
ai_flags
&
WS_AI_NUMERICHOST
))
if
(
result
&&
(
!
hints
||
!
(
hints
->
ai_flags
&
WS_AI_NUMERICHOST
))
&&
node
)
&&
node
&&
(
!
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
if
(
!
fqdn
&&
!
(
fqdn
=
get_fqdn
()))
* by sending a NULL host and avoid sending a NULL servname too because that
{
* is invalid */
HeapFree
(
GetProcessHeap
(),
0
,
nodeV6
);
ERR_
(
winediag
)(
"Failed to resolve your host name IP
\n
"
);
return
WSA_NOT_ENOUGH_MEMORY
;
result
=
getaddrinfo
(
NULL
,
servname
?
servname
:
"0"
,
punixhints
,
&
unixaires
);
}
if
(
!
strcmp
(
fqdn
,
node
)
||
(
!
strncmp
(
fqdn
,
node
,
strlen
(
node
))
&&
fqdn
[
strlen
(
node
)]
==
'.'
))
{
/* 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
* is invalid */
ERR_
(
winediag
)(
"Failed to resolve your host name IP
\n
"
);
result
=
getaddrinfo
(
NULL
,
servname
?
servname
:
"0"
,
punixhints
,
&
unixaires
);
}
}
}
TRACE
(
"%s, %s %p -> %p %d
\n
"
,
debugstr_a
(
nodename
),
debugstr_a
(
servname
),
hints
,
res
,
result
);
TRACE
(
"%s, %s %p -> %p %d
\n
"
,
debugstr_a
(
nodename
),
debugstr_a
(
servname
),
hints
,
res
,
result
);
HeapFree
(
GetProcessHeap
(),
0
,
fqdn
);
HeapFree
(
GetProcessHeap
(),
0
,
fqdn
);
...
...
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