]> source.dussan.org Git - rspamd.git/commitdiff
Merge pull request #3368 from HeinleinSupport/oletools_rework
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 14 May 2020 09:33:54 +0000 (10:33 +0100)
committerGitHub <noreply@github.com>
Thu, 14 May 2020 09:33:54 +0000 (10:33 +0100)
lua_scanner - oletools / common rework

1  2 
lualib/lua_scanners/common.lua

index 60e5c2cdffc3cd9937c2e6abe990a69c356099ef,34f83b6bdf28677b1c05727dc2690850251c15a1..a162828fb9ee37ac871cf1bd36b96767d3e71ac9
@@@ -411,16 -404,17 +408,17 @@@ local function check_parts_match(task, 
        -- check filenames in archives
        if p:is_archive() then
          local arch = p:get_archive()
 -        local filelist = arch:get_files_full()
 +        local filelist = arch:get_files_full(1000)
          for _,f in ipairs(filelist) do
            ext,ext2 = gen_extension(f.name)
-           if match_filter(task, ext, rule.mime_parts_filter_ext)
-             or match_filter(task, ext2, rule.mime_parts_filter_ext) then
-             lua_util.debugm(rule.name, task, '%s: extension matched in archive: %s', rule.log_prefix, ext)
-             extension_check = true
-           end
-           if match_filter(task, f.name, rule.mime_parts_filter_regex) then
-             content_type_check = true
+           if match_filter(task, rule, ext, rule.mime_parts_filter_ext, 'ext')
+               or match_filter(task, rule, ext2, rule.mime_parts_filter_ext, 'ext') then
+             lua_util.debugm(rule.name, task, '%s: extension matched in archive: |%s|%s|', rule.log_prefix, ext, ext2)
+             --lua_util.debugm(rule.name, task, '%s: extension matched in archive: %s', rule.log_prefix, ext)
+             return true
+           elseif match_filter(task, rule, f.name, rule.mime_parts_filter_regex, 'regex') then
+             lua_util.debugm(rule.name, task, '%s: filename regex matched in archive', rule.log_prefix)
+             return true
            end
          end
        end