From 54d8fe1f2f1d65d49b5611f33e26cae3561ee0f5 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Tue, 30 Jun 2015 08:54:46 +0300 Subject: [PATCH] Implement directBackendCmd in pipe backend --- modules/pipebackend/pipebackend.cc | 27 +++++++++++++++++++++++++++ modules/pipebackend/pipebackend.hh | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/modules/pipebackend/pipebackend.cc b/modules/pipebackend/pipebackend.cc index 2d6e9b78f..974c588e5 100644 --- a/modules/pipebackend/pipebackend.cc +++ b/modules/pipebackend/pipebackend.cc @@ -173,6 +173,33 @@ bool PipeBackend::list(const string &target, int inZoneId, bool include_disabled return true; } +string PipeBackend::directBackendCmd(const string &query) { + if (d_abiVersion < 5) + return "not supported on ABI version " + boost::lexical_cast(d_abiVersion) + "(use ABI version 5 or later)\n"; + + ostringstream oss; + + try { + ostringstream oss; + oss<<"CMD\t"<send(oss.str()); + } + catch(PDNSException &ae) { + L<receive(line); + if (line == "END") break; + oss << line << std::endl; + }; + + return oss.str(); +} + //! For the dynamic loader DNSBackend *PipeBackend::maker() { diff --git a/modules/pipebackend/pipebackend.hh b/modules/pipebackend/pipebackend.hh index fe51bfc35..e1b1edf31 100644 --- a/modules/pipebackend/pipebackend.hh +++ b/modules/pipebackend/pipebackend.hh @@ -40,7 +40,7 @@ public: void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1); bool list(const string &target, int domain_id, bool include_disabled=false); bool get(DNSResourceRecord &r); - + string directBackendCmd(const string &query); static DNSBackend *maker(); private: -- 2.40.0