ws2_32: Don't try to match host name in getaddrinfo if AI_NUMERICHOST hint is specified.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
393efc3f4d
commit
efdb722c17
|
@ -6620,7 +6620,7 @@ 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 && !strcmp(hostname, node))
|
||||
if (result && (!hints || !(hints->ai_flags & WS_AI_NUMERICHOST)) && !strcmp(hostname, 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
|
||||
|
|
|
@ -7425,6 +7425,14 @@ static void test_getaddrinfo(void)
|
|||
ok(WSAGetLastError() == 0, "expected 0, got %d\n", WSAGetLastError());
|
||||
pfreeaddrinfo(result);
|
||||
|
||||
hint.ai_flags = AI_NUMERICHOST;
|
||||
result = (void*)0xdeadbeef;
|
||||
ret = pgetaddrinfo("localhost", "80", &hint, &result);
|
||||
ok(ret == WSAHOST_NOT_FOUND, "getaddrinfo failed with %d\n", WSAGetLastError());
|
||||
ok(WSAGetLastError() == WSAHOST_NOT_FOUND, "expected WSAHOST_NOT_FOUND, got %d\n", WSAGetLastError());
|
||||
ok(!result, "result = %p\n", result);
|
||||
hint.ai_flags = 0;
|
||||
|
||||
/* try to get information from the computer name, result is the same
|
||||
* as if requesting with an empty host name. */
|
||||
ret = pgetaddrinfo(name, NULL, NULL, &result);
|
||||
|
|
Loading…
Reference in New Issue