From a528c61d4fa704c43ec98921ac8eeb8768095dd1 Mon Sep 17 00:00:00 2001 From: Christian Hofstaedtler Date: Wed, 12 Aug 2015 20:51:23 +0200 Subject: [PATCH] API: fix names in zone list being garbage --- pdns/ws-auth.cc | 3 ++- pdns/ws-recursor.cc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 93fac5e1b..2cd31911d 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 0baa019aa..7c06b5dad 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(); -- 2.40.0