]> granicus.if.org Git - pdns/commitdiff
auth: fix regression while handling user-defined axfr filters return values, and...
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Mon, 19 Mar 2018 18:47:25 +0000 (19:47 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Wed, 23 May 2018 10:28:54 +0000 (12:28 +0200)
(cherry picked from commit 8b0f2ac7e3992089e9e805f848c1cd6e54b4a975)

docs/modes-of-operation.rst
pdns/lua-auth4.cc

index 5e24b13b962592fd4f696ada9b398f91120eb19c..ab6a3007b0f59bd23222acc59430b47b2ca5ae79 100644 (file)
@@ -266,7 +266,7 @@ Consider the following simple example:
            if record:qtype() == pdns.HINFO then
               resp = {}
               resp[1] = {
-                qname   = record:qname:toString(),
+                qname   = record:qname():toString(),
                 qtype   = pdns.TXT,
                 ttl     = 99,
                 content = "Hello Ahu!"
@@ -275,7 +275,7 @@ Consider the following simple example:
            end
 
            -- Grab each _tstamp TXT record and add a time stamp
-           if record:qtype() == pdns.TXT and string.starts(record:qname:toString(), "_tstamp.") then
+           if record:qtype() == pdns.TXT and string.starts(record:qname():toString(), "_tstamp.") then
               resp = {}
               resp[1] = {
                 qname   = record:qname():toString(),
@@ -290,7 +290,7 @@ Consider the following simple example:
            if record:qtype() == pdns.A then
               resp = {}
               resp[1] = {
-                qname   = record:qname:toString(),
+                qname   = record:qname():toString(),
                 qtype   = pdns.TXT,
                 ttl     = 99,
                 content = "Hello Ahu, again!"
index 773d71090d8c73995f6ef6ce5ff4513e4130b7f5..5650e5278304c545b9d2c06906658a955f461bb0 100644 (file)
@@ -236,10 +236,17 @@ bool AuthLua4::axfrfilter(const ComboAddress& remote, const DNSName& zone, const
 
   ret = d_axfr_filter(remote, zone, in);
   rcode = std::get<0>(ret);
-  if (rcode < 0)
+  if (rcode < 0) {
+    // no modification, handle normally
     return false;
-  else if (rcode == 1)
+  }
+  else if (rcode == 0) {
+    // replace the matching record by the filtered record(s)
+  }
+  else if (rcode == 1) {
+    // append the filtered record(s) after the matching record
     out.push_back(in);
+  }
   else
     throw PDNSException("Cannot understand return code "+std::to_string(rcode)+" in axfr filter response");