Rebase against 03e9de4920173d3fa955cf28a8d2b60bd3b06261.

This commit is contained in:
Zebediah Figura
2020-08-11 19:17:01 -05:00
parent af56d3821a
commit 46420edcd0
7 changed files with 34 additions and 413 deletions

View File

@@ -1,7 +1,7 @@
From b69f0c678ad23c7ee96ec82d18bf3162afe1dac6 Mon Sep 17 00:00:00 2001
From 98db626566f8d4bcc0de8ad17fe0dabb685d69fe Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 31 Aug 2017 01:15:05 +0200
Subject: ws2_32: Fix handling of empty string in WS_getaddrinfo.
Subject: [PATCH] ws2_32: Fix handling of empty string in WS_getaddrinfo.
Fixes a regression introduced in a2053597cc326e2305c44e1c1a954c2e0ee2853e.
---
@@ -9,10 +9,10 @@ Fixes a regression introduced in a2053597cc326e2305c44e1c1a954c2e0ee2853e.
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index dce52e8fd08..45764f5a359 100644
index 4d2afa946b7..ed1ca2f44b9 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -6634,6 +6634,22 @@ static int convert_eai_u2w(int unixret) {
@@ -6673,6 +6673,22 @@ static int convert_eai_u2w(int unixret) {
return unixret;
}
@@ -35,7 +35,7 @@ index dce52e8fd08..45764f5a359 100644
static char *get_fqdn(void)
{
char *ret;
@@ -6659,9 +6675,8 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
@@ -6698,9 +6714,8 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
struct addrinfo *unixaires = NULL;
int result;
struct addrinfo unixhints, *punixhints = NULL;
@@ -46,7 +46,7 @@ index dce52e8fd08..45764f5a359 100644
*res = NULL;
if (!nodename && !servname)
@@ -6670,16 +6685,20 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
@@ -6709,16 +6724,20 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
return WSAHOST_NOT_FOUND;
}
@@ -72,7 +72,7 @@ index dce52e8fd08..45764f5a359 100644
else
{
node = nodename;
@@ -6694,6 +6713,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
@@ -6733,6 +6752,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
nodeV6 = HeapAlloc(GetProcessHeap(), 0, close_bracket - node);
if (!nodeV6)
{
@@ -80,7 +80,7 @@ index dce52e8fd08..45764f5a359 100644
HeapFree(GetProcessHeap(), 0, fqdn);
return WSA_NOT_ENOUGH_MEMORY;
}
@@ -6723,6 +6743,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
@@ -6762,6 +6782,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
if (punixhints->ai_socktype < 0)
{
SetLastError(WSAESOCKTNOSUPPORT);
@@ -88,16 +88,16 @@ index dce52e8fd08..45764f5a359 100644
HeapFree(GetProcessHeap(), 0, fqdn);
HeapFree(GetProcessHeap(), 0, nodeV6);
return SOCKET_ERROR;
@@ -6748,7 +6769,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
@@ -6787,7 +6808,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
result = getaddrinfo(node, servname, punixhints, &unixaires);
if (result && (!hints || !(hints->ai_flags & WS_AI_NUMERICHOST))
- && (!strcmp(fqdn, node) || (!strncmp(fqdn, node, hostname_len) && !node[hostname_len])))
+ && (!strcmp(node, hostname) || !strcmp(node, fqdn)))
- && node && (!strcmp(fqdn, node) || (!strncmp(fqdn, node, hostname_len) && !node[hostname_len])))
+ && node && (!strcmp(node, hostname) || !strcmp(node, fqdn)))
{
/* 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
@@ -6757,6 +6778,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
@@ -6796,6 +6817,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);
@@ -106,5 +106,5 @@ index dce52e8fd08..45764f5a359 100644
HeapFree(GetProcessHeap(), 0, nodeV6);
--
2.14.1
2.27.0