From 273d88b200143eb28cbffa9f90186393dbc04ead Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Mon, 9 May 2016 12:10:28 +0200 Subject: [PATCH] change axfr-time ALIAS expansion to use stubDoResolve; catch errors --- pdns/tcpreceiver.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pdns/tcpreceiver.cc b/pdns/tcpreceiver.cc index 3417fd11d..3ac1b9a84 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); } } -- 2.40.0