diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-10-25 10:57:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-25 10:57:05 +0200 |
commit | c87c65df7623d92409f8c67263c3bc0ae776b069 (patch) | |
tree | f09d553a38e715a844dbf9523b565a2c9486e859 | |
parent | 0edaed34e4377c4cd06e2a28d14d9117499c1826 (diff) | |
parent | 6692491ac02f47237391522302c760e94dc7214d (diff) | |
download | rspamd-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.lua | 10 |
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 |