summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-08-25 14:00:29 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-08-25 14:00:29 +0100
commitd224a23261ce2de4298f0e846d7b7866d841bf84 (patch)
treee593413f0eb9c1103eef9648624cdea8a17c7efa
parent3172ef56f69a3733c326455c906b94715ff47d40 (diff)
downloadrspamd-d224a23261ce2de4298f0e846d7b7866d841bf84.tar.gz
rspamd-d224a23261ce2de4298f0e846d7b7866d841bf84.zip
Adopt config.
-rw-r--r--conf/lua/hfilter.lua6
-rw-r--r--conf/lua/regexp/headers.lua17
-rw-r--r--conf/lua/rspamd.lua2
3 files changed, 14 insertions, 11 deletions
diff --git a/conf/lua/hfilter.lua b/conf/lua/hfilter.lua
index 18fc995c1..128c6612c 100644
--- a/conf/lua/hfilter.lua
+++ b/conf/lua/hfilter.lua
@@ -6,6 +6,8 @@
-- Weight for checks_hellohost and checks_hello: 5 - very hard, 4 - hard, 3 - meduim, 2 - low, 1 - very low.
-- From HFILTER_HELO_* and HFILTER_HOSTNAME_* symbols the maximum weight is selected in case of their actuating.
+
+local rspamd_regexp = require "rspamd_regexp"
local checks_hellohost = {
['[.-]dynamic[.-]'] = 5, ['dynamic[.-][0-9]'] = 5, ['[0-9][.-]?dynamic'] = 5,
['[.-]dyn[.-]'] = 5, ['dyn[.-][0-9]'] = 5, ['[0-9][.-]?dyn'] = 5,
@@ -53,8 +55,8 @@ local function trim1(s)
end
local function check_regexp(str, regexp_text)
- local re = regexp.get_cached(regexp_text)
- if not re then re = regexp.create(regexp_text, 'i') end
+ local re = rspamd_regexp.get_cached(regexp_text)
+ if not re then re = rspamd_regexp.create(regexp_text, 'i') end
if re:match(str) then return true end
return false
end
diff --git a/conf/lua/regexp/headers.lua b/conf/lua/regexp/headers.lua
index 7920eaa91..211b399dc 100644
--- a/conf/lua/regexp/headers.lua
+++ b/conf/lua/regexp/headers.lua
@@ -18,6 +18,7 @@
-- Definitions of header regexps
local reconf = config['regexp']
+local rspamd_regexp = require "rspamd_regexp"
-- Subject needs encoding
-- Define encodings types
@@ -228,8 +229,8 @@ local kmail_msgid_common = 'Message-Id=/^\\s*\\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 re = rspamd_regexp.get_cached(regexp_text)
+ if not re then re = rspamd_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
@@ -434,8 +435,8 @@ reconf['FORGED_GENERIC_RECEIVED4'] = 'Received=/^\\s*(.+\\n)*from localhost by \
rspamd_config.FORGED_GENERIC_RECEIVED5 = function (task)
local regexp_text = '^\\s*from \\[(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\\].*\\n(.+\\n)*\\s*from \\1 by \\S+;\\s+\\w{3}, \\d+ \\w{3} 20\\d\\d \\d\\d\\:\\d\\d\\:\\d\\d [+-]\\d\\d\\d0$'
- local re = regexp.get_cached(regexp_text)
- if not re then re = regexp.create(regexp_text, 'i') end
+ local re = rspamd_regexp.get_cached(regexp_text)
+ if not re then re = rspamd_regexp.create(regexp_text, 'i') end
local headers_recv = task:get_raw_header('Received')
if headers_recv then
for _,header_r in ipairs(headers_recv) do
@@ -455,8 +456,8 @@ rspamd_config.INVALID_EXIM_RECEIVED = function (task)
if headers_to then
local headers_recv = task:get_raw_header('Received')
local regexp_text = '^[^\\n]*?<?\\S+?\\@(\\S+)>?\\|.*from \\d+\\.\\d+\\.\\d+\\.\\d+ \\(HELO \\S+\\)[\\s\\r\\n]*by \\1 with esmtp \\(\\S*?[\\?\\@\\(\\)\\s\\.\\+\\*\'\'\\/\\\\,]\\S*\\)[\\s\\r\\n]+id \\S*?[\\)\\(<>\\/\\\\,\\-:=]'
- local re = regexp.get_cached(regexp_text)
- if not re then re = regexp.create(regexp_text, 's') end
+ local re = rspamd_regexp.get_cached(regexp_text)
+ if not re then re = rspamd_regexp.create(regexp_text, 's') end
if headers_recv then
for _,header_to in ipairs(headers_to) do
for _,header_r in ipairs(headers_recv) do
@@ -481,8 +482,8 @@ rspamd_config.INVALID_EXIM_RECEIVED2 = function (task)
if headers_to then
local headers_recv = task:get_raw_header('Received')
local regexp_text = '^[^\\n]*?<?\\S+?\\@(\\S+)>?\\|.*from \\d+\\.\\d+\\.\\d+\\.\\d+ \\(HELO \\S+\\)[\\s\\r\\n]*by \\1 with esmtp \\([A-Z]{9,12} [A-Z]{5,6}\\)[\\s\\r\\n]+id [a-zA-Z\\d]{6}-[a-zA-Z\\d]{6}-[a-zA-Z\\d]{2}[\\s\\r\\n]+'
- local re = regexp.get_cached(regexp_text)
- if not re then re = regexp.create(regexp_text, 's') end
+ local re = rspamd_regexp.get_cached(regexp_text)
+ if not re then re = rspamd_regexp.create(regexp_text, 's') end
if headers_recv then
for _,header_to in ipairs(headers_to) do
for _,header_r in ipairs(headers_recv) do
diff --git a/conf/lua/rspamd.lua b/conf/lua/rspamd.lua
index c460cf1d5..38f5ae94b 100644
--- a/conf/lua/rspamd.lua
+++ b/conf/lua/rspamd.lua
@@ -79,7 +79,7 @@ local function file_exists(filename)
end
if file_exists('hfilter.lua') then
- dofile('hfilter.lua')
+ dofile('hfilter.lua')
end
if file_exists('rspamd.local.lua') then