]> source.dussan.org Git - rspamd.git/commitdiff
* Fix patterns matching in lua plugins
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 26 Oct 2009 15:40:07 +0000 (18:40 +0300)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 26 Oct 2009 15:40:07 +0000 (18:40 +0300)
src/plugins/lua/once_received.lua
src/plugins/lua/received_rbl.lua

index 86be203800eab4b6d8a7d9ac15b39852af7860c8..2a239a7d08eea613fce3a4c230f5d660f7746d21 100644 (file)
@@ -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
index 9165d219d84c515ee1b03cedc473a2288d4c33a1..1e0f7d4d692a7a0f8f0dd244c710baf52474bd06 100644 (file)
@@ -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')