]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Support content interpolation
authorAki Tuomi <cmouse@cmouse.fi>
Fri, 27 Nov 2015 10:25:57 +0000 (12:25 +0200)
committerAki Tuomi <cmouse@cmouse.fi>
Fri, 27 Nov 2015 10:25:57 +0000 (12:25 +0200)
modules/geoipbackend/geoipbackend.cc

index cb193cd7c88f47beb37795b65db25ee538b31824..773efacd4f5ef6b4fc6cf29b7f0d72d6e6ba4906 100644 (file)
@@ -261,11 +261,10 @@ void GeoIPBackend::lookup(const QType &qtype, const DNSName& qdomain, DNSPacket
 
   auto i = dom.records.find(search);
   if (i != dom.records.end()) { // return static value
-    // we want MUTABLE rr here.
-    for(DNSResourceRecord rr : i->second) {
+    for(const auto& rr : i->second) {
       if (qtype == QType::ANY || rr.qtype == qtype) {
-        rr.content = format2str(rr.content, ip, v6, &gl);
        d_result.push_back(rr);
+        d_result.back().content = format2str(rr.content, ip, v6, &gl);
        d_result.back().qname = qdomain;
       }
     }
@@ -292,11 +291,10 @@ void GeoIPBackend::lookup(const QType &qtype, const DNSName& qdomain, DNSPacket
     // see if the record can be found
     auto ri = dom.records.find(DNSName(format));
     if (ri != dom.records.end()) { // return static value
-      // we want MUTABLE rr here.
-      for(DNSResourceRecord rr : ri->second) {
+      for(const auto& rr: ri->second) {
         if (qtype == QType::ANY || rr.qtype == qtype) {
-          rr.content = format2str(rr.content, ip, v6, &gl);
           d_result.push_back(rr);
+          d_result.back().content = format2str(rr.content, ip, v6, &gl);
           d_result.back().qname = qdomain;
         }
       }