From: Ruben d'Arco Date: Fri, 27 Apr 2012 17:45:51 +0000 (+0200) Subject: Fix trac 444 X-Git-Tag: auth-3.3-rc1~96^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F783%2Fhead;p=thirdparty%2Fpdns.git Fix trac 444 Make sure we query for '*' whenever we've moved all the way up the tree. --- diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc old mode 100644 new mode 100755 index 1fabbf49ab..088d9e16b0 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -332,10 +332,14 @@ bool PacketHandler::getBestWildcard(DNSPacket *p, SOAData& sd, const string &tar bool haveSomething=false; wildcard=subdomain; - while ( chopOff( subdomain ) && !haveSomething ) { - B.lookup(QType(QType::ANY), "*."+subdomain, p, sd.domain_id); + while( chopOff( subdomain ) && !haveSomething ) { + if (subdomain.empty()) { + B.lookup(QType(QType::ANY), "*", p, sd.domain_id); + } else { + B.lookup(QType(QType::ANY), "*."+subdomain, p, sd.domain_id); + } while(B.get(rr)) { - if(rr.qtype == p->qtype ||rr.qtype.getCode() == QType::CNAME || (p->qtype.getCode() == QType::ANY && rr.qtype.getCode() != QType::RRSIG)) + if(rr.qtype == p->qtype || rr.qtype.getCode() == QType::CNAME || (p->qtype.getCode() == QType::ANY && rr.qtype.getCode() != QType::RRSIG)) ret->push_back(rr); wildcard="*."+subdomain; haveSomething=true;