Skip to content

Commit

Permalink
FindNS lookup should actually look at an UeberBackend. This solves mi…
Browse files Browse the repository at this point in the history
…nd04's concerns. It also makes the code compile again.
  • Loading branch information
ahupowerdns committed Feb 23, 2017
1 parent afad964 commit 6615722
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions pdns/communicator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -243,18 +243,18 @@ private:
class FindNS
{
public:
vector<string> lookup(const DNSName &name, DNSBackend *b)
vector<string> lookup(const DNSName &name, UeberBackend *b)
{
vector<string> addresses;

this->resolve_name(&addresses, name);

if(b) {
b->lookup(QType(QType::ANY),name);
DNSResourceRecord rr;
DNSZoneRecord rr;
while(b->get(rr))
if(rr.qtype.getCode() == QType::A || rr.qtype.getCode()==QType::AAAA)
addresses.push_back(rr.content); // SOL if you have a CNAME for an NS
if(rr.dr.d_type == QType::A || rr.dr.d_type==QType::AAAA)
addresses.push_back(rr.dr.d_content->getZoneRepresentation()); // SOL if you have a CNAME for an NS
}
return addresses;
}
Expand Down
14 changes: 7 additions & 7 deletions pdns/mastercommunicator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,34 +46,34 @@ void CommunicatorClass::queueNotifyDomain(const DomainInfo& di, UeberBackend* B)
{
bool hasQueuedItem=false;
set<string> nsset, ips;
DNSResourceRecord rr;
DNSZoneRecord rr;
FindNS fns;


if (d_onlyNotify.size()) {
B->lookup(QType(QType::NS),domain);
B->lookup(QType(QType::NS), di.zone);
while(B->get(rr))
nsset.insert(rr.content);
nsset.insert(getRR<NSRecordContent>(rr.dr)->getNS().toString());

for(set<string>::const_iterator j=nsset.begin();j!=nsset.end();++j) {
vector<string> nsips=fns.lookup(DNSName(*j), B);
if(nsips.empty())
L<<Logger::Warning<<"Unable to queue notification of domain '"<<domain<<"': nameservers do not resolve!"<<endl;
L<<Logger::Warning<<"Unable to queue notification of domain '"<<di.zone<<"': nameservers do not resolve!"<<endl;
else
for(vector<string>::const_iterator k=nsips.begin();k!=nsips.end();++k) {
const ComboAddress caIp(*k, 53);
if(!d_preventSelfNotification || !AddressIsUs(caIp)) {
if(!d_onlyNotify.match(&caIp))
L<<Logger::Info<<"Skipped notification of domain '"<<domain<<"' to "<<*j<<" because it does not match only-notify."<<endl;
L<<Logger::Info<<"Skipped notification of domain '"<<di.zone<<"' to "<<*j<<" because it does not match only-notify."<<endl;
else
ips.insert(caIp.toStringWithPort());
}
}
}

for(set<string>::const_iterator j=ips.begin();j!=ips.end();++j) {
L<<Logger::Warning<<"Queued notification of domain '"<<domain<<"' to "<<*j<<endl;
d_nq.add(domain,*j);
L<<Logger::Warning<<"Queued notification of domain '"<<di.zone<<"' to "<<*j<<endl;
d_nq.add(di.zone,*j);
hasQueuedItem=true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion pdns/tcpreceiver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ bool TCPNameserver::canDoAXFR(shared_ptr<DNSPacket> q)
while(B->get(rr))
nsset.insert(DNSName(rr.content));
for(const auto & j: nsset) {
vector<string> nsips=fns.lookup(j, B);
vector<string> nsips=fns.lookup(j, s_P->getBackend());
for(vector<string>::const_iterator k=nsips.begin();k!=nsips.end();++k) {
// cerr<<"got "<<*k<<" from AUTO-NS"<<endl;
if(*k == q->getRemote().toString())
Expand Down

0 comments on commit 6615722

Please sign in to comment.