From: Peter van Dijk Date: Mon, 9 May 2016 10:10:28 +0000 (+0200) Subject: change axfr-time ALIAS expansion to use stubDoResolve; catch errors X-Git-Tag: rec-4.0.0-alpha3~1^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=273d88b200143eb28cbffa9f90186393dbc04ead;p=thirdparty%2Fpdns.git change axfr-time ALIAS expansion to use stubDoResolve; catch errors --- diff --git a/pdns/tcpreceiver.cc b/pdns/tcpreceiver.cc index 3417fd11db..3ac1b9a843 100644 --- a/pdns/tcpreceiver.cc +++ b/pdns/tcpreceiver.cc @@ -54,6 +54,7 @@ #include "communicator.hh" #include "namespaces.hh" #include "signingpipe.hh" +#include "stubresolver.hh" extern PacketCache PC; extern StatBag S; @@ -738,14 +739,18 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr q, int ou while(sd.db->get(rr)) { if(rr.qname.isPartOf(target)) { if (rr.qtype.getCode() == QType::ALIAS && ::arg().mustDo("outgoing-axfr-expand-alias")) { - FindNS fns; - vector ips=fns.lookup(DNSName(rr.content), (DNSBackend *) NULL); + vector ips; + int ret1 = stubDoResolve(rr.content, QType::A, ips); + int ret2 = stubDoResolve(rr.content, QType::AAAA, ips); + if(ret1 != RCode::NoError || ret2 != RCode::NoError) { + L<setRcode(2); // 'SERVFAIL' + sendPacket(outpacket,outsock); + return 0; + } for(const auto& ip: ips) { - if(ip.find(":") == string::npos) - rr.qtype = QType(QType::A); - else - rr.qtype = QType(QType::AAAA); - rr.content = ip; + rr.qtype = ip.qtype; + rr.content = ip.content; rrs.push_back(rr); } }