From: Ruben d'Arco Date: Mon, 5 Nov 2012 17:02:03 +0000 (+0100) Subject: Add list-zone capability to pdns_control X-Git-Tag: rec-3.6.0-rc1~147^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=767da1a052492217467dc802bee30c42e5c4ff08;p=pdns Add list-zone capability to pdns_control --- diff --git a/pdns/dynhandler.cc b/pdns/dynhandler.cc index 308b87aae..8c85569e4 100644 --- a/pdns/dynhandler.cc +++ b/pdns/dynhandler.cc @@ -32,6 +32,7 @@ #include "dnsseckeeper.hh" #include "nameserver.hh" #include "responsestats.hh" +#include "ueberbackend.hh" extern ResponseStats g_rs; @@ -286,3 +287,35 @@ string DLReloadHandler(const vector&parts, Utility::pid_t ppid) return "Ok"; } +string DLListZones(const vector&parts, Utility::pid_t ppid) +{ + UeberBackend B; + L< domains; + B.getAllDomains(&domains); + ostringstream ret; + int kindFilter = -1; + if (parts.size() > 1) { + if (toUpper(parts[1]) == "MASTER") + kindFilter = 0; + else if (toUpper(parts[1]) == "SLAVE") + kindFilter = 1; + else if (toUpper(parts[1]) == "NATIVE") + kindFilter = 2; + } + + int count = 0; + + for (vector::const_iterator di=domains.begin(); di != domains.end(); di++) { + if (di->kind == kindFilter || kindFilter == -1) { + ret<zone<&parts, Utility::pid_t ppid); string DLPurgeHandler(const vector&parts, Utility::pid_t ppid); string DLNotifyRetrieveHandler(const vector&parts, Utility::pid_t ppid); string DLCurrentConfigHandler(const vector&parts, Utility::pid_t ppid); +string DLListZones(const vector&parts, Utility::pid_t ppid); #endif /* PDNS_DYNHANDLER_HH */ diff --git a/pdns/receiver.cc b/pdns/receiver.cc old mode 100644 new mode 100755 index 61a9f9124..83155f28a --- a/pdns/receiver.cc +++ b/pdns/receiver.cc @@ -578,6 +578,7 @@ int main(int argc, char **argv) DynListener::registerFunc("SET",&DLSettingsHandler, "set config variables", " "); DynListener::registerFunc("RETRIEVE",&DLNotifyRetrieveHandler, "retrieve slave domain", ""); DynListener::registerFunc("CURRENT-CONFIG",&DLCurrentConfigHandler, "Retrieve the current configuration"); + DynListener::registerFunc("LIST-ZONES",&DLListZones, "Show list of zones", "[]"); if(!::arg()["tcp-control-address"].empty()) { DynListener* dlTCP=new DynListener(ComboAddress(::arg()["tcp-control-address"], ::arg().asNum("tcp-control-port")));