summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-05-26 17:04:20 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-05-26 17:04:20 +0100
commitdab0284b43b12159f8adc70b70255aad9e6df85d (patch)
treea60ab59b8dc7848d40992f24c64ef197b85cb701 /src
parenta595f00595b1c2ad1e4244d0da02cae14bc7279b (diff)
downloadrspamd-dab0284b43b12159f8adc70b70255aad9e6df85d.tar.gz
rspamd-dab0284b43b12159f8adc70b70255aad9e6df85d.zip
[Minor] Mime_types: Fix bad archive extension check if there are many files in an archive
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/mime_types.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/lua/mime_types.lua b/src/plugins/lua/mime_types.lua
index 1760f3cb5..564241cc1 100644
--- a/src/plugins/lua/mime_types.lua
+++ b/src/plugins/lua/mime_types.lua
@@ -211,7 +211,7 @@ local function check_mime_type(task)
return ext[1],ext[2],parts
end
- local function check_filename(fname, ct, is_archive, part, detected_ext)
+ local function check_filename(fname, ct, is_archive, part, detected_ext, nfiles)
local has_bad_unicode, char, ch_pos = rspamd_util.has_obscured_unicode(fname)
if has_bad_unicode then
@@ -247,7 +247,7 @@ local function check_mime_type(task)
if detected_ext and ((not ext) or ext ~= detected_ext) then
-- Try to find extension by real content type
check_filename('detected.' .. detected_ext, detected.ct,
- false, part, nil)
+ false, part, nil, 1)
end
if not ext then return end
@@ -315,7 +315,7 @@ local function check_mime_type(task)
local function check_tables(e)
if is_archive then
- return extra_archive_table[e] or settings.bad_archive_extensions[e] or
+ return extra_archive_table[e] or (nfiles < 2 and settings.bad_archive_extensions[e]) or
extra_table[e] or settings.bad_extensions[e]
end
@@ -395,7 +395,7 @@ local function check_mime_type(task)
local detected_ext = p:get_detected_ext()
if filename then
- check_filename(filename, ct, false, p, detected_ext)
+ check_filename(filename, ct, false, p, detected_ext, 1)
end
if p:is_archive() then
@@ -448,7 +448,7 @@ local function check_mime_type(task)
if f['name'] then
check_filename(f['name'], nil,
- true, p, nil)
+ true, p, nil, nfiles)
end
end