]> granicus.if.org Git - pdns/commitdiff
cleanup abomination where we serialized dnsnames to strings
authorbert hubert <bert.hubert@powerdns.com>
Tue, 24 Nov 2015 16:06:24 +0000 (17:06 +0100)
committerbert hubert <bert.hubert@powerdns.com>
Tue, 24 Nov 2015 16:06:24 +0000 (17:06 +0100)
pdns/syncres.cc
pdns/syncres.hh

index 0442042eed05b81097354befbaaa28331ab9f96e..b040e39c3d3ff30bf023ccd53fa194a9421142c9 100644 (file)
@@ -567,8 +567,7 @@ void SyncRes::getBestNSFromCache(const DNSName &qname, const QType& qtype, vecto
         answer.qname=qname;
        answer.qtype=qtype.getCode();
        for(const auto& dr : bestns)
-         answer.bestns.insert(make_pair(dr.d_name, dr.d_content->getZoneRepresentation()));
-       // XXX we are passing a DNSName through a string here!
+         answer.bestns.insert(make_pair(dr.d_name, std::dynamic_pointer_cast<NSRecordContent>(dr.d_content)->getNS()));
 
         if(beenthere.count(answer)) {
          brokeloop=true;
@@ -1213,7 +1212,7 @@ int SyncRes::doResolveAt(set<DNSName> nameservers, DNSName auth, bool flawedNSSe
         }
         else if(rec.d_place==DNSResourceRecord::ANSWER && rec.d_name == qname && rec.d_type==QType::CNAME && (!(qtype==QType(QType::CNAME)))) {
           ret.push_back(rec);
-          newtarget=DNSName(rec.d_content->getZoneRepresentation());
+          newtarget=std::dynamic_pointer_cast<CNAMERecordContent>(rec.d_content)->getTarget();
         }
        else if(d_doDNSSEC && (rec.d_type==QType::RRSIG || rec.d_type==QType::NSEC || rec.d_type==QType::NSEC3) && rec.d_place==DNSResourceRecord::ANSWER){
          if(rec.d_type != QType::RRSIG || rec.d_name == qname)
@@ -1241,7 +1240,7 @@ int SyncRes::doResolveAt(set<DNSName> nameservers, DNSName auth, bool flawedNSSe
           else {
             LOG(prefix<<qname.toString()<<": got upwards/level NS record '"<<rec.d_name.toString()<<"' -> '"<<rec.d_content->getZoneRepresentation()<<"', had '"<<auth.toString()<<"'"<<endl);
          }
-          nsset.insert(DNSName(rec.d_content->getZoneRepresentation()));
+          nsset.insert(std::dynamic_pointer_cast<NSRecordContent>(rec.d_content)->getNS());
         }
         else if(rec.d_place==DNSResourceRecord::AUTHORITY && qname.isPartOf(rec.d_name) && rec.d_type==QType::DS) {
          LOG(prefix<<qname.toString()<<": got DS record '"<<rec.d_name.toString()<<"' -> '"<<rec.d_content->getZoneRepresentation()<<"'"<<endl);
index e0251d4672edb7f9f290f65e8db5e817682e424b..d3f39f425b6d17bcf637d6c43ff1a823f99c07b8 100644 (file)
@@ -476,7 +476,7 @@ private:
   struct GetBestNSAnswer
   {
     DNSName qname;
-    set<pair<DNSName,string> > bestns; // FIXME400 right side really should be DNSName too
+    set<pair<DNSName,DNSName> > bestns; 
     uint8_t qtype; // only A and AAAA anyhow
     bool operator<(const GetBestNSAnswer &b) const
     {