From: Tomas Krizek Date: Mon, 9 Mar 2020 13:48:02 +0000 (+0100) Subject: modules/policy: polict.rpz() shouldn't watch file when watch=false X-Git-Tag: v5.1.0~32^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a70b6b75888bb83c9d8e3f275d89bbd2cf47f0aa;p=thirdparty%2Fknot-resolver.git modules/policy: polict.rpz() shouldn't watch file when watch=false --- diff --git a/NEWS b/NEWS index db4cd7a28..a343d8076 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ Improvements Bugfixes -------- - cache: missing filesystem support for pre-allocation is no longer fatal (#549) +- lua: policy.rpz() no longer watches the file when watch is set to false (!954) Knot Resolver 5.0.1 (2020-02-05) diff --git a/modules/policy/README.rst b/modules/policy/README.rst index 657ead6fc..0cc196ba3 100644 --- a/modules/policy/README.rst +++ b/modules/policy/README.rst @@ -285,11 +285,11 @@ Most properties (actions, filters) are described above. Like suffix match, but you can also provide a common suffix of all matches for faster processing (nil otherwise). This function is faster for small suffix tables (in the order of "hundreds"). -.. function:: policy.rpz(action, path, [watch]) +.. function:: policy.rpz(action, path, [watch = true]) :param action: the default action for match in the zone; typically you want ``policy.DENY`` :param path: path to zone file | database - :param watch: boolean, if not false, the file will be reloaded on file change + :param watch: boolean, if true, the file will be reloaded on file change Enforce RPZ_ rules. This can be used in conjunction with published blocklist feeds. The RPZ_ operation is well described in this `Jan-Piet Mens's post`_, diff --git a/modules/policy/policy.lua b/modules/policy/policy.lua index de58c31fe..2cc8f5ed6 100644 --- a/modules/policy/policy.lua +++ b/modules/policy/policy.lua @@ -403,7 +403,7 @@ end function policy.rpz(action, path, watch) local rules = rpz_parse(action, path) - if watch or true then + if watch ~= false then local has_notify, notify = pcall(require, 'cqueues.notify') if has_notify then local bit = require('bit')