From: Charles-Henri Bruyand Date: Mon, 19 Mar 2018 18:47:25 +0000 (+0100) Subject: auth: fix regression while handling user-defined axfr filters return values, and... X-Git-Tag: dnsdist-1.3.0~39^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F6370%2Fhead;p=thirdparty%2Fpdns.git auth: fix regression while handling user-defined axfr filters return values, and a typo in a documentation example --- diff --git a/docs/modes-of-operation.rst b/docs/modes-of-operation.rst index 69b17b6d2a..365eab4b66 100644 --- a/docs/modes-of-operation.rst +++ b/docs/modes-of-operation.rst @@ -272,7 +272,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!" @@ -281,7 +281,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(), @@ -296,7 +296,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!" 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");