From: Christian Hofstaedtler Date: Wed, 12 Aug 2015 18:51:23 +0000 (+0200) Subject: API: fix names in zone list being garbage X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~62^2~9^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a528c61d4fa704c43ec98921ac8eeb8768095dd1;p=thirdparty%2Fpdns.git API: fix names in zone list being garbage --- diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 93fac5e1ba..2cd31911d9 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -296,7 +296,8 @@ static void fillZoneInfo(const DomainInfo& di, Value& jdi, Document& doc) { string url = "/servers/localhost/zones/" + zoneId; Value jurl(url.c_str(), doc.GetAllocator()); // copy jdi.AddMember("url", jurl, doc.GetAllocator()); - jdi.AddMember("name", di.zone.toString().c_str(), doc.GetAllocator()); + Value jname(di.zone.toString().c_str(), doc.GetAllocator()); // copy + jdi.AddMember("name", jname, doc.GetAllocator()); jdi.AddMember("kind", di.getKindString(), doc.GetAllocator()); jdi.AddMember("dnssec", dk.isSecuredZone(di.zone), doc.GetAllocator()); jdi.AddMember("account", di.account.c_str(), doc.GetAllocator()); diff --git a/pdns/ws-recursor.cc b/pdns/ws-recursor.cc index 0baa019aab..7c06b5dad2 100644 --- a/pdns/ws-recursor.cc +++ b/pdns/ws-recursor.cc @@ -149,7 +149,8 @@ static void fillZone(const string& zonename, HttpResponse* resp) string url = "/servers/localhost/zones/" + zoneId; Value jurl(url.c_str(), doc.GetAllocator()); // copy doc.AddMember("url", jurl, doc.GetAllocator()); - doc.AddMember("name", iter->first.toString().c_str(), doc.GetAllocator()); + Value jname(iter->first.toString().c_str(), doc.GetAllocator()); // copy + doc.AddMember("name", jname, doc.GetAllocator()); doc.AddMember("kind", zone.d_servers.empty() ? "Native" : "Forwarded", doc.GetAllocator()); Value servers; servers.SetArray();