]> granicus.if.org Git - pdns/commitdiff
syncres: fix moreSpecificThan()
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 15 Jul 2015 14:48:29 +0000 (16:48 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Wed, 15 Jul 2015 14:48:53 +0000 (16:48 +0200)
pdns/syncres.cc

index 19b32741b7947d15d043d8759a646446c70cf605..eda5eaeaae552510429e11559f09f479135371d9 100644 (file)
@@ -787,10 +787,9 @@ bool SyncRes::doCacheCheck(const DNSName &qname, const QType &qtype, vector<DNSR
   return false;
 }
 
-// FIXME400 use DNSName.isPartOf
 bool SyncRes::moreSpecificThan(const DNSName& a, const DNSName &b)
 {
-  return a.countLabels() > b.countLabels();
+  return (a.isPartOf(b) && a.countLabels() > b.countLabels());
 }
 
 struct speedOrder
@@ -1176,7 +1175,7 @@ int SyncRes::doResolveAt(set<DNSName> nameservers, DNSName auth, bool flawedNSSe
           done=true;
           ret.push_back(*i);
         }
-        else if(i->d_place==DNSResourceRecord::AUTHORITY && dottedEndsOn(qname,i->qname) && i->qtype.getCode()==QType::NS) {
+        else if(i->d_place==DNSResourceRecord::AUTHORITY && qname.isPartOf(i->qname) && i->qtype.getCode()==QType::NS) {
           if(moreSpecificThan(i->qname,auth)) {
             newauth=i->qname;
             LOG(prefix<<qname.toString()<<": got NS record '"<<i->qname.toString()<<"' -> '"<<i->content<<"'"<<endl);