From 7bdd945a2b92df450d122ae41d9592d48ad93e6b Mon Sep 17 00:00:00 2001 From: Christian Hofstaedtler Date: Tue, 11 Feb 2014 22:07:59 +0100 Subject: [PATCH] Fix zone id corruption in Recursor JSON API --- pdns/ws-recursor.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pdns/ws-recursor.cc b/pdns/ws-recursor.cc index 53bbbf486a..fc262d622a 100644 --- a/pdns/ws-recursor.cc +++ b/pdns/ws-recursor.cc @@ -119,7 +119,8 @@ static void fillZone(const string& zonename, HttpResponse* resp) // id is the canonical lookup key, which doesn't actually match the name (in some cases) string zoneId = apiZoneNameToId(iter->first); - doc.AddMember("id", zoneId.c_str(), doc.GetAllocator()); + Value jzoneid(zoneId.c_str(), doc.GetAllocator()); // copy + doc.AddMember("id", jzoneid, doc.GetAllocator()); string url = "/servers/localhost/zones/" + zoneId; Value jurl(url.c_str(), doc.GetAllocator()); // copy doc.AddMember("url", jurl, doc.GetAllocator()); @@ -271,7 +272,8 @@ static void apiServerZones(HttpRequest* req, HttpResponse* resp) jdi.SetObject(); // id is the canonical lookup key, which doesn't actually match the name (in some cases) string zoneId = apiZoneNameToId(val.first); - jdi.AddMember("id", zoneId.c_str(), doc.GetAllocator()); + Value jzoneid(zoneId.c_str(), doc.GetAllocator()); // copy + jdi.AddMember("id", jzoneid, doc.GetAllocator()); string url = "/servers/localhost/zones/" + zoneId; Value jurl(url.c_str(), doc.GetAllocator()); // copy jdi.AddMember("url", jurl, doc.GetAllocator()); -- 2.47.2