Commit efdb722c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ws2_32: Don't try to match host name in getaddrinfo if AI_NUMERICHOST hint is specified.

parent 393efc3f
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment