# HG changeset patch # User Matthew Wild # Date 1589213910 -3600 # Node ID b872f111b7af4ff0619be9d8ee60ac72950c5806 # Parent 001c756ead7de0973836250f110345947b9d49fc mod_firewall: Add option to ignore missing list files diff -r 001c756ead7d -r b872f111b7af mod_firewall/definitions.lib.lua --- a/mod_firewall/definitions.lib.lua Sun May 10 09:03:16 2020 +0200 +++ b/mod_firewall/definitions.lib.lua Mon May 11 17:18:30 2020 +0100 @@ -10,6 +10,7 @@ local new_throttle = require "util.throttle".create; local hashes = require "util.hashes"; local jid = require "util.jid"; +local lfs = require "lfs"; local multirate_cache_size = module:get_option_number("firewall_multirate_cache_limit", 1000); @@ -150,6 +151,10 @@ local items = {}; local n = 0; local filename = file_spec:gsub("^file:", ""); + if opts.missing == "ignore" and not lfs.attributes(filename, "mode") then + module:log("debug", "Ignoring missing list file: %s", filename); + return; + end local file, err = io.open(filename); if not file then module:log("warn", "Failed to open list from %s: %s", filename, err);