diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-12 17:40:57 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-12 17:40:57 +0000 |
commit | efe42811baf2c935208982ae99db246ab43d2f50 (patch) | |
tree | 7f10e4b4f47b2be869030d373121030f6dcc81c8 /src/plugins/lua/spamassassin.lua | |
parent | 5a89fb3d70928a1250397f9a8b1d228023f29e6e (diff) | |
download | rspamd-efe42811baf2c935208982ae99db246ab43d2f50.tar.gz rspamd-efe42811baf2c935208982ae99db246ab43d2f50.zip |
Add globbing support
Diffstat (limited to 'src/plugins/lua/spamassassin.lua')
-rw-r--r-- | src/plugins/lua/spamassassin.lua | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua index 45be259df..89ff0853e 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 |