From d076a01250cf67efd268b3677b6d68d45acddf4e Mon Sep 17 00:00:00 2001 From: bert hubert Date: Tue, 24 Nov 2015 17:06:24 +0100 Subject: [PATCH] cleanup abomination where we serialized dnsnames to strings --- pdns/syncres.cc | 7 +++---- pdns/syncres.hh | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 0442042ee..b040e39c3 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -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(dr.d_content)->getNS())); if(beenthere.count(answer)) { brokeloop=true; @@ -1213,7 +1212,7 @@ int SyncRes::doResolveAt(set 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(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 nameservers, DNSName auth, bool flawedNSSe else { LOG(prefix< '"<getZoneRepresentation()<<"', had '"<getZoneRepresentation())); + nsset.insert(std::dynamic_pointer_cast(rec.d_content)->getNS()); } else if(rec.d_place==DNSResourceRecord::AUTHORITY && qname.isPartOf(rec.d_name) && rec.d_type==QType::DS) { LOG(prefix< '"<getZoneRepresentation()<<"'"< > bestns; // FIXME400 right side really should be DNSName too + set > bestns; uint8_t qtype; // only A and AAAA anyhow bool operator<(const GetBestNSAnswer &b) const { -- 2.40.0