]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
add get-zone to pdns-recursor. Untested. ch2500, go! ;-)
authorbert hubert <bert.hubert@netherlabs.nl>
Tue, 2 Jul 2013 12:06:01 +0000 (14:06 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Tue, 2 Jul 2013 12:06:01 +0000 (14:06 +0200)
pdns/json_ws.cc

index 2e49429c1c13ae3e6919b2d2082e6525ada95d16..47055e5bcb5d036c51b2f3eb4ddf053a23506254 100644 (file)
@@ -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<string>(val.ttl);
+       stats["priority"] = lexical_cast<string>(val.priority);
+       stats["content"] = val.content;
+       content += returnJSONObject(stats);
+      }
+    }
+    content += "]";
+  }  
   else if(varmap["command"]=="flush-cache") {
     string canon=toCanonic("", varmap["domain"]);
     int count = broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeCache, canon));