]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Rework MISSING_SUBJECT rule.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 7 Aug 2015 15:28:43 +0000 (16:28 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 7 Aug 2015 15:28:43 +0000 (16:28 +0100)
Issue: #343
Reported by: @moisseev

rules/regexp/headers.lua

index f026d548bff8788edd56db06108973601bcaf1f1..9255de792be50a5d2e313eabb1d003a49c83860c 100644 (file)
@@ -32,11 +32,16 @@ reconf['SUBJECT_NEEDS_ENCODING'] = string.format('!(%s) & !(%s) & (%s)', subject
 -- Detects that there is no space in From header (e.g. Some Name<some@host>)
 reconf['R_NO_SPACE_IN_FROM'] = 'From=/\\S<[-\\w\\.]+\\@[-\\w\\.]+>/X'
 
--- Detects missing subject
-local has_subject = 'header_exists(Subject)'
-local empty_subject = 'Subject=/^$/'
--- Final rule
-reconf['MISSING_SUBJECT'] = string.format('!(%s) | (%s)', has_subject, empty_subject)
+
+rspamd_config.MISSING_SUBJECT = function(task)
+  local hdr = task:get_header('Subject')
+  
+  if not hdr or #hdr == 0 then
+    return true
+  end
+  
+  return false
+end
 
 -- Detects bad content-transfer-encoding for text parts
 -- For text parts (text/plain and text/html mainly)