aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-10-25 10:57:05 +0200
committerGitHub <noreply@github.com>2016-10-25 10:57:05 +0200
commitc87c65df7623d92409f8c67263c3bc0ae776b069 (patch)
treef09d553a38e715a844dbf9523b565a2c9486e859
parent0edaed34e4377c4cd06e2a28d14d9117499c1826 (diff)
parent6692491ac02f47237391522302c760e94dc7214d (diff)
downloadrspamd-c87c65df7623d92409f8c67263c3bc0ae776b069.tar.gz
rspamd-c87c65df7623d92409f8c67263c3bc0ae776b069.zip
Merge pull request #1067 from fatalbanana/av
[Feature] Allow for excluding messages from AV scanning based on size
-rw-r--r--src/plugins/lua/antivirus.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua
index 42c1fbf24..d4a0f7bba 100644
--- a/src/plugins/lua/antivirus.lua
+++ b/src/plugins/lua/antivirus.lua
@@ -162,18 +162,24 @@ local function sophos_config(opts)
return nil
end
+local function message_not_too_large(task, rule)
+ local max_size = tonumber(rule['max_size'])
+ if not max_size then return true end
+ if task:get_size() > max_size then return false end
+ return true
+end
local function need_av_check(task, rule)
if rule['attachments_only'] then
for _,p in ipairs(task:get_parts()) do
if p:get_filename() and not p:is_image() then
- return true
+ return message_not_too_large(task, rule)
end
end
return false
else
- return true
+ return message_not_too_large(task, rule)
end
end