File 6370.patch of Package pdns.openSUSE_Backports_SLE-12-SP1

Based on: https://github.com/PowerDNS/pdns/pull/6370

From 8b0f2ac7e3992089e9e805f848c1cd6e54b4a975 Mon Sep 17 00:00:00 2001
From: Charles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Date: Mon, 19 Mar 2018 19:47:25 +0100
Subject: [PATCH] auth: fix regression while handling user-defined axfr filters
 return values, and a typo in a documentation example

---
 docs/modes-of-operation.rst |  6 +++---
 pdns/lua-auth4.cc           | 11 +++++++++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/pdns/lua-auth4.cc b/pdns/lua-auth4.cc
index db9bb0ab37..f7a3414ad1 100644
--- a/pdns/lua-auth4.cc
+++ b/pdns/lua-auth4.cc
@@ -113,10 +113,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");
 
openSUSE Build Service is sponsored by