S.inc("backend-queries");
DNSResourceRecord rr;
- rr.auth = true;
-
int hits=0;
- while(this->get(rr)) {
- if (rr.qtype != QType::SOA) throw PDNSException("Got non-SOA record when asking for SOA");
- hits++;
- fillSOAData(rr.content, sd);
- sd.domain_id=rr.domain_id;
- sd.ttl=rr.ttl;
- }
-
- if(!hits)
- return false;
+ sd.db = nullptr;
- sd.qname = domain;
- sd.db=this;
+ try {
+ while (this->get(rr)) {
+ if (rr.qtype != QType::SOA) {
+ throw PDNSException("Got non-SOA record when asking for SOA, zone: '" + domain.toLogString() + "'");
+ }
+ hits++;
+ sd.qname = domain;
+ sd.ttl = rr.ttl;
+ sd.db = this;
+ sd.domain_id = rr.domain_id;
+ fillSOAData(rr.content, sd);
+ }
+ }
+ catch (const PDNSException& e) {
+ while (this->get(rr)) {
+ ;
+ }
+ throw;
+ }
- return true;
+ return hits;
}
bool DNSBackend::get(DNSZoneRecord& dzr)
data.minimum = pdns_stou(parts.at(6).c_str());
}
catch(const std::out_of_range& oor) {
- throw PDNSException("Out of range exception parsing "+content);
+ throw PDNSException("Out of range exception parsing '" + content + "'");
}
}
DomainInfo di;
try {
- if (!B.getDomainInfo(zone, di)) {
+ if (!B.getDomainInfo(zone, di, false)) {
cout << "[Error] Unable to get zone information for zone '" << zone << "'" << endl;
return 1;
}
}
SOAData sd;
- if(!B.getSOAUncached(zone, sd)) {
- cout<<"[Error] No SOA record present, or active, in zone '"<<zone<<"'"<<endl;
+ try {
+ if (!B.getSOAUncached(zone, sd)) {
+ cout << "[Error] No SOA record present, or active, in zone '" << zone << "'" << endl;
+ numerrors++;
+ cout << "Checked 0 records of '" << zone << "', " << numerrors << " errors, 0 warnings." << endl;
+ return 1;
+ }
+ }
+ catch (const PDNSException& e) {
+ cout << "[Error] SOA lookup failed: " << e.reason << endl;
numerrors++;
- cout<<"Checked 0 records of '"<<zone<<"', "<<numerrors<<" errors, 0 warnings."<<endl;
- return 1;
+ if (!sd.db) {
+ return 1;
+ }
}
NSEC3PARAMRecordContent ns3pr;
stringtok(parts, rr.content);
if(parts.size() < 7) {
- cout<<"[Warning] SOA autocomplete is deprecated, missing field(s) in SOA content: "<<rr.qname<<" IN " <<rr.qtype.toString()<< " '" << rr.content<<"'"<<endl;
+ cout << "[Info] SOA autocomplete is deprecated, missing field(s) in SOA content: " << rr.qname << " IN " << rr.qtype.toString() << " '" << rr.content << "'" << endl;
}
ostringstream o;