From: Andrew Lewis Date: Mon, 24 Oct 2016 09:40:49 +0000 (+0200) Subject: [Feature] Allow for excluding messages from AV scanning based on size X-Git-Tag: 1.4.0~199^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F1067%2Fhead;p=rspamd.git [Feature] Allow for excluding messages from AV scanning based on size --- 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