X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/d8d9f9301c9a31c826635bbdd334bb4be99ea05a..75c121f07a85b4029458f11b113a4655114af126:/src/src/dns.c diff --git a/src/src/dns.c b/src/src/dns.c index cb1766618..0f0b435de 100644 --- a/src/src/dns.c +++ b/src/src/dns.c @@ -639,6 +639,10 @@ up nameservers that produce this error continually, so there is the option of providing a list of domains for which this is treated as a non-existent host. +The dns_answer structure is pretty big; enough to hold a max-sized DNS message +- so best allocated from fast-release memory. As of writing, all our callers +use a stack-auto variable. + Arguments: dnsa pointer to dns_answer structure name name to look up @@ -693,7 +697,7 @@ if ((previous = tree_search(tree_dns_fails, node_name))) DEBUG(D_dns) debug_printf("DNS name '%s' utf8 conversion to alabel failed: %s\n", name, errstr); - host_find_failed_syntax = TRUE; + f.host_find_failed_syntax = TRUE; return DNS_NOMATCH; } name = alabel; @@ -738,7 +742,7 @@ if (check_dns_names_pattern[0] != 0 && type != T_PTR && type != T_TXT) DEBUG(D_dns) debug_printf("DNS name syntax check failed: %s (%s)\n", name, dns_text_type(type)); - host_find_failed_syntax = TRUE; + f.host_find_failed_syntax = TRUE; return DNS_NOMATCH; } } @@ -761,7 +765,7 @@ if ((type == T_A || type == T_AAAA) && string_is_ip_address(name, NULL) != 0) (res_search), we call fakens_search(), which recognizes certain special domains, and interfaces to a fake nameserver for certain special zones. */ -dnsa->answerlen = running_in_test_harness +dnsa->answerlen = f.running_in_test_harness ? fakens_search(name, type, dnsa->answer, sizeof(dnsa->answer)) : res_search(CCS name, C_IN, type, dnsa->answer, sizeof(dnsa->answer)); @@ -885,7 +889,7 @@ for (i = 0; i <= dns_cname_loops; i++) uschar * data; dns_record *rr, cname_rr, type_rr; dns_scan dnss; - int datalen, rc; + int rc; /* DNS lookup failures get passed straight back. */ @@ -947,8 +951,8 @@ for (i = 0; i <= dns_cname_loops; i++) return DNS_FAIL; data = store_get(256); - if ((datalen = dn_expand(dnsa->answer, dnsa->answer + dnsa->answerlen, - cname_rr.data, (DN_EXPAND_ARG4_TYPE)data, 256)) < 0) + if (dn_expand(dnsa->answer, dnsa->answer + dnsa->answerlen, + cname_rr.data, (DN_EXPAND_ARG4_TYPE)data, 256) < 0) return DNS_FAIL; name = data; @@ -1101,7 +1105,7 @@ switch (type) && (h->rcode == NOERROR || h->rcode == NXDOMAIN) && ntohs(h->qdcount) == 1 && ntohs(h->ancount) == 0 && ntohs(h->nscount) >= 1) - dnsa->answerlen = MAXPACKET; + dnsa->answerlen = sizeof(dnsa->answer); for (rr = dns_next_rr(dnsa, &dnss, RESET_AUTHORITY); rr; rr = dns_next_rr(dnsa, &dnss, RESET_NEXT)