From: Aki Tuomi Date: Sat, 26 Oct 2013 19:20:54 +0000 (+0300) Subject: Fix handling of empty lookup/list result X-Git-Tag: rec-3.6.0-rc1~374^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a16fad02c1b1fc9484b9c07b9ce98491aea05aa2;p=pdns Fix handling of empty lookup/list result --- diff --git a/modules/remotebackend/remotebackend.cc b/modules/remotebackend/remotebackend.cc index 1fcebd324..98d058210 100644 --- a/modules/remotebackend/remotebackend.cc +++ b/modules/remotebackend/remotebackend.cc @@ -192,8 +192,8 @@ void RemoteBackend::lookup(const QType &qtype, const std::string &qdomain, DNSPa return; } - // OK. we have result parameters in result - if ((*d_result)["result"].IsArray() == false) { + // OK. we have result parameters in result. do not process empty result. + if ((*d_result)["result"].IsArray() == false || (*d_result)["result"].Size() < 1) { delete d_result; return; } @@ -222,7 +222,7 @@ bool RemoteBackend::list(const std::string &target, int domain_id) { delete d_result; return false; } - if ((*d_result)["result"].IsArray() == false) { + if ((*d_result)["result"].IsArray() == false || (*d_result)["result"].Size() < 1) { delete d_result; return false; } @@ -233,6 +233,7 @@ bool RemoteBackend::list(const std::string &target, int domain_id) { bool RemoteBackend::get(DNSResourceRecord &rr) { if (d_index == -1) return false; + rapidjson::Value value; value = "";