From: Pieter Lexis Date: Tue, 12 Mar 2019 11:09:53 +0000 (+0100) Subject: pdnsutil: error on broken IPs in masters field X-Git-Tag: rec-4.2.0-rc1~35^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4d76766d0b0158a12c9ca94d047f0015e5f23e23;p=thirdparty%2Fpdns.git pdnsutil: error on broken IPs in masters field --- diff --git a/pdns/backends/gsql/gsqlbackend.cc b/pdns/backends/gsql/gsqlbackend.cc index 95f850c811..29c890a8ab 100644 --- a/pdns/backends/gsql/gsqlbackend.cc +++ b/pdns/backends/gsql/gsqlbackend.cc @@ -292,14 +292,16 @@ bool GSQLBackend::getDomainInfo(const DNSName &domain, DomainInfo &di, bool getS } catch (...) { return false; } + string type=d_result[0][5]; + di.account=d_result[0][6]; + di.kind = DomainInfo::stringToKind(type); + vector masters; stringtok(masters, d_result[0][2], " ,\t"); for(const auto& m : masters) di.masters.emplace_back(m, 53); di.last_check=pdns_stou(d_result[0][3]); di.notified_serial = pdns_stou(d_result[0][4]); - string type=d_result[0][5]; - di.account=d_result[0][6]; di.backend=this; di.serial = 0; @@ -316,8 +318,6 @@ bool GSQLBackend::getDomainInfo(const DNSName &domain, DomainInfo &di, bool getS } } - di.kind = DomainInfo::stringToKind(type); - return true; } @@ -1265,6 +1265,13 @@ void GSQLBackend::getAllDomains(vector *domains, bool include_disabl } catch (...) { continue; } + + if (pdns_iequals(row[3], "MASTER")) + di.kind = DomainInfo::Master; + else if (pdns_iequals(row[3], "SLAVE")) + di.kind = DomainInfo::Slave; + else + di.kind = DomainInfo::Native; if (!row[4].empty()) { vector masters; @@ -1280,13 +1287,6 @@ void GSQLBackend::getAllDomains(vector *domains, bool include_disabl di.last_check = pdns_stou(row[6]); di.account = row[7]; - if (pdns_iequals(row[3], "MASTER")) - di.kind = DomainInfo::Master; - else if (pdns_iequals(row[3], "SLAVE")) - di.kind = DomainInfo::Slave; - else - di.kind = DomainInfo::Native; - di.backend = this; domains->push_back(di); diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index cd753330f5..e7de035cff 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -239,10 +239,23 @@ bool rectifyAllZones(DNSSECKeeper &dk, bool quiet = false) int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, const vector* suppliedrecords=0) { + uint64_t numerrors=0, numwarnings=0; + + DomainInfo di; + try { + B.getDomainInfo(zone, di); + } catch(const PDNSException &e) { + if (di.kind == DomainInfo::Slave) { + cout<<"[Error] non-IP address for masters: "< checkKeyErrors; bool validKeys=dk.checkKeys(zone, &checkKeyErrors); - uint64_t numerrors=0, numwarnings=0; - if (haveNSEC3) { if(isSecure && zone.wirelength() > 222) { numerrors++;