]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow for excluding messages from AV scanning based on size 1067/head
authorAndrew Lewis <nerf@judo.za.org>
Mon, 24 Oct 2016 09:40:49 +0000 (11:40 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 24 Oct 2016 12:14:17 +0000 (14:14 +0200)
src/plugins/lua/antivirus.lua

index 42c1fbf241026348f8f58e409be3faa91cc71358..d4a0f7bba4e11e5b53f13efec82b396756993128 100644 (file)
@@ -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