aboutsummaryrefslogtreecommitdiffstats
path: root/conf/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-02-22 15:55:44 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-02-22 15:55:44 +0300
commit5492467747da01e72fe8b9e80ebee28121c68dc6 (patch)
tree51d32febc9ef01ed71e28b5284afc6b8bda3f368 /conf/lua
parentdac3240ef6da39b5e332d9d5cbe7aca215cc5d43 (diff)
downloadrspamd-5492467747da01e72fe8b9e80ebee28121c68dc6.tar.gz
rspamd-5492467747da01e72fe8b9e80ebee28121c68dc6.zip
Rules update.
Submitted by: Victor Ustugov
Diffstat (limited to 'conf/lua')
-rw-r--r--conf/lua/regexp/headers.lua32
1 files changed, 16 insertions, 16 deletions
diff --git a/conf/lua/regexp/headers.lua b/conf/lua/regexp/headers.lua
index 69b239d85..cad6eca6b 100644
--- a/conf/lua/regexp/headers.lua
+++ b/conf/lua/regexp/headers.lua
@@ -208,23 +208,23 @@ reconf['FORGED_MUA_THEBAT_MSGID_UNKNOWN'] = string.format('(%s) & !(%s) & !(%s)
local kmail_mua = 'User-Agent=/^\\s*KMail\\/1\\.\\d+\\.\\d+/H'
-- KMail common Message-ID template
local kmail_msgid_common = 'Message-Id=/^\\s*\\d+\\.\\d+\\.\\S+\\@\\S+$/mH'
--- local kmail_msgid = function (task)
--- rspamd_logger.info("test kmail_msgid")
--- local msg = task:get_message()
--- local regexp_text = '<(\\S+)>\\|<(19[789]\\d|20\\d\\d)(0\\d|1[012])([012]\\d|3[01])([0-5]\\d)([0-5]\\d)\\.\\d+\\.\\1>$'
--- local re = regexp.get_cached(regexp_text)
--- if not re then re = regexp.create(regexp_text, '') end
--- local header_msgid = msg:get_header('Message-Id')
--- for _,header_from in ipairs(msg:get_header('From')) do
--- if re:match(header_from.."|"..header_msgid) then
--- return true
--- end
--- end
--- return false
--- end
-local kmail_msgid = 'Message-Id=/^(19[789]\\d|20\\d\\d)(0\\d|1[012])([012]\\d|3[01])([0-5]\\d)([0-5]\\d)\\.\\d+\\.\\S+\\@\\S+$/mH'
+function kmail_msgid (task)
+ local msg = task:get_message()
+ local regexp_text = '<(\\S+)>\\|(19[789]\\d|20\\d\\d)(0\\d|1[012])([012]\\d|3[01])([0-5]\\d)([0-5]\\d)\\.\\d+\\.\\1$'
+ local re = regexp.get_cached(regexp_text)
+ if not re then re = regexp.create(regexp_text, '') end
+ local header_msgid = msg:get_header('Message-Id')
+ if header_msgid then
+ for _,header_from in ipairs(msg:get_header('From')) do
+ if re:match(header_from.."|"..header_msgid[1]) then
+ return true
+ end
+ end
+ end
+ return false
+end
-- Summary rule for forged KMail Message-ID header
-reconf['FORGED_MUA_KMAIL_MSGID'] = string.format('(%s) & (%s) & !(%s) & !(%s)', kmail_mua, kmail_msgid_common, kmail_msgid, unusable_msgid)
+reconf['FORGED_MUA_KMAIL_MSGID'] = string.format('(%s) & (%s) & !(%s) & !(%s)', kmail_mua, kmail_msgid_common, 'kmail_msgid', unusable_msgid)
-- Summary rule for forged KMail Message-ID header with unknown template
reconf['FORGED_MUA_KMAIL_MSGID_UNKNOWN'] = string.format('(%s) & !(%s) & !(%s)', kmail_mua, kmail_msgid_common, unusable_msgid)