Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Habbie
Created April 26, 2013 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Habbie/5466779 to your computer and use it in GitHub Desktop.
Save Habbie/5466779 to your computer and use it in GitHub Desktop.
diff -ur pdns-3.1.org/pdns/packethandler.cc pdns-3.1/pdns/packethandler.cc
--- pdns-3.1.org/pdns/packethandler.cc 2012-07-29 21:27:04.998039695 +0200
+++ pdns-3.1/pdns/packethandler.cc 2012-07-29 21:25:28.904166138 +0200
@@ -314,24 +314,29 @@
ret->clear();
DNSResourceRecord rr;
string subdomain(target);
- while( chopOff( subdomain )) {
+ bool haveSomething=false;
+
+ while ( chopOff( subdomain ) && !haveSomething ) {
B.lookup(QType(QType::ANY), "*."+subdomain, p, sd.domain_id);
- bool haveSomething=false;
while(B.get(rr)) {
if(rr.qtype == p->qtype ||rr.qtype.getCode() == QType::CNAME || p->qtype.getCode() == QType::ANY)
- ret->push_back(rr);
+ ret->push_back(rr);
wildcard="*."+subdomain;
haveSomething=true;
}
-
- if(haveSomething)
- return true;
-
- if(subdomain == sd.qname) // stop at SOA
+
+ if ( subdomain == sd.qname || haveSomething ) // stop at SOA or result
break;
- }
- return false;
+ B.lookup(QType(QType::ANY), subdomain, p, sd.domain_id);
+ if (B.get(rr)) {
+ DLOG(L<<"No wildcard match, ancestor exists"<<endl);
+ while (B.get(rr)) ;
+ break;
+ }
+ }
+
+ return haveSomething;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment