From: bert hubert Date: Tue, 2 Jul 2013 12:06:01 +0000 (+0200) Subject: add get-zone to pdns-recursor. Untested. ch2500, go! ;-) X-Git-Tag: rec-3.6.0-rc1~600 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=41ef0ed4b1681c339fa8fef153c2ff70a460e05d;p=thirdparty%2Fpdns.git add get-zone to pdns-recursor. Untested. ch2500, go! ;-) --- diff --git a/pdns/json_ws.cc b/pdns/json_ws.cc index 2e49429c1c..47055e5bcb 100644 --- a/pdns/json_ws.cc +++ b/pdns/json_ws.cc @@ -107,7 +107,28 @@ void JWebserver::readRequest(int fd) content += returnJSONObject(stats); } content += "]"; - } + } + else if(varmap["command"] =="get-zone") { + SyncRes::domainmap_t::const_iterator ret = t_sstorage->domainmap->find(varmap["zone"]); + + content += "["; + bool first=1; + + if(ret != t_sstorage->domainmap->end()) { + BOOST_FOREACH(const SyncRes::AuthDomain::records_t::value_type& val, ret->second.d_records) { + if(!first) content+= ", "; + first=false; + stats.clear(); + stats["name"] = val.qname; + stats["type"] = val.qtype.getName(); + stats["ttl"] = lexical_cast(val.ttl); + stats["priority"] = lexical_cast(val.priority); + stats["content"] = val.content; + content += returnJSONObject(stats); + } + } + content += "]"; + } else if(varmap["command"]=="flush-cache") { string canon=toCanonic("", varmap["domain"]); int count = broadcastAccFunction(boost::bind(pleaseWipeCache, canon));