replacement value. (The only way to fix this properly would be to
re-implement res_search() and res_query() so that they don't muddle their
success and packet length return values.) For added safety we only reset
-the packet length if the packet header looks plausible. */
+the packet length if the packet header looks plausible.
-static void
+Return TRUE iff it seemed ok */
+
+static BOOL
fake_dnsa_len_for_fail(dns_answer * dnsa, int type)
{
const HEADER * h = (const HEADER *)dnsa->answer;
DEBUG(D_dns) debug_printf("faking res_search(%s) response length as %d\n",
dns_text_type(type), (int)sizeof(dnsa->answer));
dnsa->answerlen = sizeof(dnsa->answer);
+ return TRUE;
}
+DEBUG(D_dns) debug_printf("DNS: couldn't fake dnsa len\n");
+/* Maybe we should just do a second lookup for an SOA? */
+return FALSE;
}
{
dns_scan dnss;
-fake_dnsa_len_for_fail(dnsa, type);
+if (!fake_dnsa_len_for_fail(dnsa, type)) return 0;
for (dns_record * rr = dns_next_rr(dnsa, &dnss, RESET_AUTHORITY);
rr; rr = dns_next_rr(dnsa, &dnss, RESET_NEXT)
if (rc == DNS_NOMATCH)
{
- fake_dnsa_len_for_fail(dnsa, T_CSA);
+ if (!fake_dnsa_len_for_fail(dnsa, T_CSA)) return DNS_NOMATCH;
for (rr = dns_next_rr(dnsa, &dnss, RESET_AUTHORITY);
rr; rr = dns_next_rr(dnsa, &dnss, RESET_NEXT)
DNS lookup of 4.3.2.V4NET.in-addr.arpa (PTR) using fakens
DNS lookup of 4.3.2.V4NET.in-addr.arpa (PTR) gave HOST_NOT_FOUND
returning DNS_NOMATCH
-DNS: no SOA record found for neg-TTL
+DNS: couldn't fake dnsa len
writing neg-cache entry for 4.3.2.V4NET.in-addr.arpa-PTR-xxxx, ttl -1
LOG: host_lookup_failed MAIN
no host name found for IP address V4NET.2.3.4
DNS lookup of 12.11.10.V4NET.in-addr.arpa (PTR) using fakens
DNS lookup of 12.11.10.V4NET.in-addr.arpa (PTR) gave HOST_NOT_FOUND
returning DNS_NOMATCH
-DNS: no SOA record found for neg-TTL
+DNS: couldn't fake dnsa len
writing neg-cache entry for 12.11.10.V4NET.in-addr.arpa-PTR-xxxx, ttl -1
LOG: host_lookup_failed MAIN
no host name found for IP address V4NET.10.11.12
DNS lookup of 1.1.1.V4NET.in-addr.arpa (PTR) using fakens
DNS lookup of 1.1.1.V4NET.in-addr.arpa (PTR) gave HOST_NOT_FOUND
returning DNS_NOMATCH
-DNS: no SOA record found for neg-TTL
+DNS: couldn't fake dnsa len
writing neg-cache entry for 1.1.1.V4NET.in-addr.arpa-PTR-xxxx, ttl -1
LOG: host_lookup_failed MAIN
no host name found for IP address V4NET.1.1.1
DNS lookup of 2.2.2.V4NET.in-addr.arpa (PTR) using fakens
DNS lookup of 2.2.2.V4NET.in-addr.arpa (PTR) gave HOST_NOT_FOUND
returning DNS_NOMATCH
-DNS: no SOA record found for neg-TTL
+DNS: couldn't fake dnsa len
writing neg-cache entry for 2.2.2.V4NET.in-addr.arpa-PTR-xxxx, ttl -1
LOG: host_lookup_failed MAIN
no host name found for IP address V4NET.2.2.2
DNS lookup of dontqualify (A) using fakens
DNS lookup of dontqualify (A) gave NO_DATA
returning DNS_NODATA
-DNS: no SOA record found for neg-TTL
+DNS: couldn't fake dnsa len
writing neg-cache entry for dontqualify-A-xxxx, ttl -1
fully qualified name = mxt1c.test.ex
host_find_bydns yield = HOST_FIND_FAILED (0); returned hosts:
DNS lookup of cioce.test.again.dns (MX) gave TRY_AGAIN
cioce.test.again.dns in dns_again_means_nonexist? yes (matched "*")
cioce.test.again.dns is in dns_again_means_nonexist: returning DNS_NOMATCH
-DNS: no SOA record found for neg-TTL
+DNS: couldn't fake dnsa len
writing neg-cache entry for cioce.test.again.dns-MX-xxxx, ttl -1
creating new cache entry
lookup failed
DNS lookup of cioce.test.again.dns (A) gave TRY_AGAIN
cioce.test.again.dns in dns_again_means_nonexist? yes (matched "*")
cioce.test.again.dns is in dns_again_means_nonexist: returning DNS_NOMATCH
-DNS: no SOA record found for neg-TTL
+DNS: couldn't fake dnsa len
writing neg-cache entry for cioce.test.again.dns-A-xxxx, ttl -1
host_fake_gethostbyname(af=inet) returned 1 (HOST_NOT_FOUND)
no IP address found for host cioce.test.again.dns (during SMTP connection from the.local.host.name [ip4.ip4.ip4.ip4])