summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-10-27 16:41:14 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-10-27 16:41:14 +0300
commit9c36d3f9efae2ee0b8c4322e9df1af5bef84678f (patch)
tree7df0d548f6fab6f33ae28574506600b449fdee91 /src/plugins
parentf94a016916b5f2b08d15c46d2cada9149507f16b (diff)
downloadrspamd-9c36d3f9efae2ee0b8c4322e9df1af5bef84678f.tar.gz
rspamd-9c36d3f9efae2ee0b8c4322e9df1af5bef84678f.zip
* Convert all string values to lowercase in once_received module
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/once_received.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/plugins/lua/once_received.lua b/src/plugins/lua/once_received.lua
index 2a239a7d0..3840eb0b0 100644
--- a/src/plugins/lua/once_received.lua
+++ b/src/plugins/lua/once_received.lua
@@ -15,15 +15,18 @@ function check_quantity_received (task)
if symbol_strict then
local r = recvh[1]
-- Unresolved host
- if not r['real_hostname'] or r['real_hostname'] == 'unknown' or string.match(r['real_hostname'], '^%d+%.%d+%.%d+%.%d+$') then
+ if not r['real_hostname'] or string.lower(r['real_hostname']) == 'unknown' or string.match(r['real_hostname'], '^%d+%.%d+%.%d+%.%d+$') then
task:insert_result(metric, symbol_strict, 1)
end
+
local i = true
+ local hn = string.lower(r['real_hostname'])
+
for _,h in ipairs(bad_hosts) do
- if string.find(r['real_hostname'], h) then
+ if string.find(hn, h) then
-- Check for good hostname
for _,gh in ipairs(good_hosts) do
- if string.find(r['real_hostname'], gh) then
+ if string.find(hn, gh) then
i = false
break
end
@@ -48,9 +51,9 @@ if opts then
if n == 'symbol_strict' then
symbol_strict = v
elseif n == 'bad_host' then
- table.insert(bad_hosts, v)
+ table.insert(bad_hosts, string.lower(v))
elseif n == 'good_host' then
- table.insert(good_hosts, v)
+ table.insert(good_hosts, string.lower(v))
elseif n == 'metric' then
metric = v
end