From: Vsevolod Stakhov Date: Mon, 26 Oct 2009 15:40:07 +0000 (+0300) Subject: * Fix patterns matching in lua plugins X-Git-Tag: 0.3.0~144 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f94a016916b5f2b08d15c46d2cada9149507f16b;p=rspamd.git * Fix patterns matching in lua plugins --- diff --git a/src/plugins/lua/once_received.lua b/src/plugins/lua/once_received.lua index 86be20380..2a239a7d0 100644 --- a/src/plugins/lua/once_received.lua +++ b/src/plugins/lua/once_received.lua @@ -15,7 +15,7 @@ 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 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 diff --git a/src/plugins/lua/received_rbl.lua b/src/plugins/lua/received_rbl.lua index 9165d219d..1e0f7d4d6 100644 --- a/src/plugins/lua/received_rbl.lua +++ b/src/plugins/lua/received_rbl.lua @@ -13,7 +13,7 @@ local rbls = {} function dns_cb(task, to_resolve, results, err) if results then - local _,_,rbl = string.find(to_resolve, '%d+\.%d+\.%d+\.%d+\.(.+)') + local _,_,rbl = string.find(to_resolve, '%d+%.%d+%.%d+%.%d+%.(.+)') task:insert_result(metric, symbol, 1, rbl) end end @@ -23,7 +23,7 @@ function received_cb (task) for _,rh in ipairs(recvh) do for k,v in pairs(rh) do if k == 'real_ip' then - local _,_,o1,o2,o3,o4 = string.find(v, '(%d+)\.(%d+)\.(%d+)\.(%d+)') + local _,_,o1,o2,o3,o4 = string.find(v, '(%d+)%.(%d+)%.(%d+)%.(%d+)') for _,rbl in ipairs(rbls) do rbl_str = o4 .. '.' .. o3 .. '.' .. o2 .. '.' .. o1 .. '.' .. rbl task:resolve_dns_a(rbl_str, 'dns_cb')