From: Vsevolod Stakhov Date: Tue, 12 Jan 2016 17:40:57 +0000 (+0000) Subject: Add globbing support X-Git-Tag: 1.1.0~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efe42811baf2c935208982ae99db246ab43d2f50;p=thirdparty%2Frspamd.git Add globbing support --- diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua index 45be259df4..89ff0853e5 100644 --- a/src/plugins/lua/spamassassin.lua +++ b/src/plugins/lua/spamassassin.lua @@ -1292,23 +1292,31 @@ if type(section) == "table" then else if type(fn) == 'table' then for k, elt in ipairs(fn) do - f = io.open(elt, "r") + local files = util.glob(elt) + + for i,matched in ipairs(files) do + f = io.open(matched, "r") + if f then + process_sa_conf(f) + has_rules = true + else + rspamd_logger.errx(rspamd_config, "cannot open %s", matched) + end + end + end + else + -- assume string + local files = util.glob(fn) + + for i,matched in ipairs(files) do + f = io.open(matched, "r") if f then process_sa_conf(f) has_rules = true else - rspamd_logger.errx(rspamd_config, "cannot open %s", elt) + rspamd_logger.errx(rspamd_config, "cannot open %s", matched) end end - else - -- assume string - f = io.open(fn, "r") - if f then - process_sa_conf(f) - has_rules = true - else - rspamd_logger.errx(rspamd_config, "cannot open %s", fn) - end end end end