int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, const vector<DNSResourceRecord>* suppliedrecords=0)
{
+ uint64_t numerrors=0, numwarnings=0;
+
+ DomainInfo di;
+ try {
+ if (!B.getDomainInfo(zone, di)) {
+ cout<<"[Error] Unable to get domain information for zone '"<<zone<<"'"<<endl;
+ return 1;
+ }
+ } catch(const PDNSException &e) {
+ if (di.kind == DomainInfo::Slave) {
+ cout<<"[Error] non-IP address for masters: "<<e.reason<<endl;
+ numerrors++;
+ }
+ }
+
SOAData sd;
if(!B.getSOAUncached(zone, sd)) {
cout<<"[Error] No SOA record present, or active, in zone '"<<zone<<"'"<<endl;
- cout<<"Checked 0 records of '"<<zone<<"', 1 errors, 0 warnings."<<endl;
+ numerrors++;
+ cout<<"Checked 0 records of '"<<zone<<"', "<<numerrors<<" errors, 0 warnings."<<endl;
return 1;
}
vector<string> checkKeyErrors;
bool validKeys=dk.checkKeys(zone, &checkKeyErrors);
- uint64_t numerrors=0, numwarnings=0;
-
if (haveNSEC3) {
if(isSecure && zone.wirelength() > 222) {
numerrors++;
sort(keys.begin(),keys.end());
reverse(keys.begin(),keys.end());
- bool shown=false;
for(const auto& key : keys) {
string algname = DNSSECKeeper::algorithm2name(key.d_algorithm);
cout << "DNSKEY = " <<zone.toString()<<" IN DNSKEY "<< key.getZoneRepresentation() << "; ( " + algname + " ) " <<endl;
}
- if (shown) continue;
- shown=true;
-
const std::string prefix(exportDS ? "" : "DS = ");
cout<<prefix<<zone.toString()<<" IN DS "<<makeDSFromDNSKey(zone, key, DNSSECKeeper::SHA1).getZoneRepresentation() << " ; ( SHA1 digest )" << endl;
cout<<prefix<<zone.toString()<<" IN DS "<<makeDSFromDNSKey(zone, key, DNSSECKeeper::SHA256).getZoneRepresentation() << " ; ( SHA256 digest )" << endl;
// move records
if (!src->list(di.zone, di.id, true)) throw PDNSException("Failed to list records");
nr=0;
+
+ tgt->startTransaction(di.zone, di_new.id);
+
while(src->get(rr)) {
rr.domain_id = di_new.id;
if (!tgt->feedRecord(rr, DNSName())) throw PDNSException("Failed to feed record");
nr++;
}
+
// move comments
nc=0;
if (src->listComments(di.id)) {
nk++;
}
}
+ tgt->commitTransaction();
cout<<"Moved "<<nr<<" record(s), "<<nc<<" comment(s), "<<nm<<" metadata(s) and "<<nk<<" cryptokey(s)"<<endl;
}