From: Christian Hofstaedtler Date: Tue, 11 Feb 2014 21:07:59 +0000 (+0100) Subject: Fix zone id corruption in Recursor JSON API X-Git-Tag: rec-3.6.0-rc1~183^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7bdd945a2b92df450d122ae41d9592d48ad93e6b;p=thirdparty%2Fpdns.git Fix zone id corruption in Recursor JSON API --- 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());