asyn-thread: avoid using GetAddrInfoExW with impersonation

Multiple reports suggest that GetAddrInfoExW fails when impersonation is
used. This PR checks if thread is impersonating and avoids using
GetAddrInfoExW api.

Reported-by: Keerthi Timmaraju
Assisted-by: edmcln on github
Fixes #13612
Closes #13738
This commit is contained in:
Pavel P 2024-05-22 01:23:34 +02:00 committed by Daniel Stenberg
parent 30de937bda
commit 0caadc1f24
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 14 additions and 1 deletions

View file

@ -638,7 +638,8 @@ static bool init_resolve_thread(struct Curl_easy *data,
#ifdef _WIN32
if(Curl_isWindows8OrGreater && Curl_FreeAddrInfoExW &&
Curl_GetAddrInfoExCancel && Curl_GetAddrInfoExW) {
Curl_GetAddrInfoExCancel && Curl_GetAddrInfoExW &&
!Curl_win32_impersonating()) {
#define MAX_NAME_LEN 256 /* max domain name is 253 chars */
#define MAX_PORT_LEN 8
WCHAR namebuf[MAX_NAME_LEN];