From c9865bc5188996d73f8a807c49a4387cfd17cf32 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Fri, 26 Dec 2014 22:17:25 +0100 Subject: [PATCH] add create-zone, load-zone and list-zone to pdnssec --- pdns/pdnssec.cc | 109 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 1 deletion(-) diff --git a/pdns/pdnssec.cc b/pdns/pdnssec.cc index 780c7830c..4638e38f6 100644 --- a/pdns/pdnssec.cc +++ b/pdns/pdnssec.cc @@ -703,6 +703,82 @@ int deleteZone(const string &zone) { return 1; } +int listZone(const string &zone) { + UeberBackend B; + DomainInfo di; + + if (! B.getDomainInfo(zone, di)) { + cerr<<"Domain '"<list(zone, di.id); + DNSResourceRecord rr; + while(di.backend->get(rr)) { + if(rr.qtype.getCode()) { + if ( (rr.qtype.getCode() == QType::NS || rr.qtype.getCode() == QType::SRV || rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::CNAME) && !rr.content.empty() && rr.content[rr.content.size()-1] != '.') + rr.content.append(1, '.'); + + cout<startTransaction(zone, di.id)) { + cerr<<"Unable to start transaction for load of zone '"<feedRecord(rr); + } + db->commitTransaction(); + return 0; +} + +int createZone(const string &zone) { + UeberBackend B; + DomainInfo di; + if (B.getDomainInfo(zone, di)) { + cerr<<"Domain '"<