diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-04 17:05:59 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-04 17:05:59 +0100 |
commit | 96d2e7d8e7206b79b6e12b7013e92665b1678dd3 (patch) | |
tree | 2ef974cb1da73dee714b0b37775a509206b1f72e | |
parent | 08f877d662302d9298917a02cf9488ec6f97cee9 (diff) | |
download | rspamd-96d2e7d8e7206b79b6e12b7013e92665b1678dd3.tar.gz rspamd-96d2e7d8e7206b79b6e12b7013e92665b1678dd3.zip |
[Feature] Support archives when matching patterns in multimap
-rw-r--r-- | src/plugins/lua/multimap.lua | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 9f0d92849..786a9a492 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -344,16 +344,28 @@ local function multimap_callback(task, pre_filter) end end -- Filename rules + local function check_file(fn) + _.each(function(r) + match_filename(r, fn) + end, + _.filter(function(r) + return pre_filter == r['prefilter'] and r['type'] == 'filename' + end, rules)) + end + local parts = task:get_parts() for i,p in ipairs(parts) do - local fn = p:get_filename() - if fn then - _.each(function(r) - match_filename(r, fn) - end, - _.filter(function(r) - return pre_filter == r['prefilter'] and r['type'] == 'filename' - end, rules)) + if p:is_archive() then + local fnames = p:get_archive():get_files() + + for ii,fn in ipairs(fnames) do + check_file(fn) + end + else + local fn = p:get_filename() + if fn then + check_file(fn) + end end end -- RBL rules |