]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix trac 444 783/head
authorRuben d'Arco <cyclops@prof-x.net>
Fri, 27 Apr 2012 17:45:51 +0000 (19:45 +0200)
committerRuben d'Arco <cyclops@prof-x.net>
Tue, 7 May 2013 20:43:24 +0000 (22:43 +0200)
Make sure we query for '*' whenever we've moved all the way up the tree.

pdns/packethandler.cc [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 1fabbf4..088d9e1
@@ -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;