https://bugs.winehq.org/show_bug.cgi?id=54819
Bug ID: 54819 Summary: DnsQuery_A() mishandles CNAME DNS records Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: dnsapi Assignee: wine-bugs@winehq.org Reporter: fgouget@codeweavers.com Distribution: ---
Specifically this breaks the wpad auto-proxy lookups through this chain: InternetQueryOptionW(NULL,...) + INTERNET_PER_CONN_FLAGS (as per wininet:internet) -> calls query_global_option() -> calls get_proxy_autoconfig_url() -> calls detect_proxy_autoconfig_url_dns() -> calls getaddrinfo(AI_DNS_ONLY) -> calls DnsQuery_A()
Removing AI_DNS_ONLY bypasses DnsQuery_A() and gets more sensible results... but see bug 52133.
So anyway, if you have something like this in your DNS configuration:
ns A 192.168.3.1 wpad CNAME ns
You get nonsensical results like:
0024:trace:wininet:detect_proxy_autoconfig_url_dns family=2 addr={ family AF_INET, address 192.159.62.1, port 0 } canon=(null) 0024:trace:wininet:detect_proxy_autoconfig_url_dns family=2 addr={ family AF_INET, address 192.168.3.1, port 0 } canon=(null) 0024:trace:wininet:detect_proxy_autoconfig_url_dns family=23 addr={ family AF_INET6, address 20a0:3e01::7800:7800:7800:7800, flow label 0, port 0, scope 0 } canon=(null)
The 192.168.3.1 is as expected but the 192.159.62.1 result should not be there and, because it comes first, detect_proxy_autoconfig_url_dns() returns the wrong URL! Also one gets a different bad IP address for wpad.foo and wpad.bar.
Furthermore this issue can be fixed by changing the DNS confguration to:
ns A 192.168.3.1 wpad A 192.168.3.1
So this issue is specific to CNAMEs.
Additional notes: * I found this issue while debugging bug 54818 but it actually makes no difference there, it just results in the wrong url getting returned. * I don't think the IPv6 result makes sense but I'm not sure yet.
https://bugs.winehq.org/show_bug.cgi?id=54819
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |hans@meelstraat.net
https://bugs.winehq.org/show_bug.cgi?id=54819
--- Comment #1 from Hans Leidekker hans@meelstraat.net --- Created attachment 74318 --> https://bugs.winehq.org/attachment.cgi?id=74318 patch
Does this patch help?
https://bugs.winehq.org/show_bug.cgi?id=54819
--- Comment #2 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Hans Leidekker from comment #1)
Created attachment 74318 [details] patch
Does this patch help?
- for (ptr = rec; ptr; ptr = ptr->pNext) { if (rec->wType == DNS_TYPE_A) count++; };
- for (ptr = rec6; ptr; ptr = ptr->pNext) { if (rec->wType == DNS_TYPE_AAAA) count++; };
ptr->wType?
for (ptr = rec6; ptr; ptr = ptr->pNext) {
if (rec->wType != DNS_TYPE_AAAA) continue;
Same here.
https://bugs.winehq.org/show_bug.cgi?id=54819
--- Comment #3 from Hans Leidekker hans@meelstraat.net --- Yes, thanks.
https://bugs.winehq.org/show_bug.cgi?id=54819
Hans Leidekker hans@meelstraat.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #74318|0 |1 is obsolete| |
--- Comment #4 from Hans Leidekker hans@meelstraat.net --- Created attachment 74319 --> https://bugs.winehq.org/attachment.cgi?id=74319 patch
https://bugs.winehq.org/show_bug.cgi?id=54819
--- Comment #5 from François Gouget fgouget@codeweavers.com --- Wow, that was fast! Thanks, that works.
https://bugs.winehq.org/show_bug.cgi?id=54819
Hans Leidekker hans@meelstraat.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|NEW |RESOLVED Fixed by SHA1| |f512b3c08ccfc9b9c235964002e | |644e2cbd657cf Component|dnsapi |winsock
--- Comment #6 from Hans Leidekker hans@meelstraat.net --- Fixed with f512b3c08ccfc9b9c235964002e644e2cbd657cf.
https://bugs.winehq.org/show_bug.cgi?id=54819
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 8.6.
https://bugs.winehq.org/show_bug.cgi?id=54819
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |8.0.x
https://bugs.winehq.org/show_bug.cgi?id=54819
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|8.0.x |---
--- Comment #8 from Michael Stefaniuc mstefani@winehq.org --- Removing the 8.0.x milestone from bug fixes included in 8.0.2.