]> source.dussan.org Git - rspamd.git/commitdiff
Allow FCrDNS-style RBL lookups 26/head
authorAndrew Lewis <nerf@judo.za.org>
Wed, 22 Jan 2014 11:50:01 +0000 (13:50 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Wed, 22 Jan 2014 11:50:01 +0000 (13:50 +0200)
src/plugins/lua/rbl.lua

index e7e720908167908f9438b5203e147d7a17ab348f..c180898d4389235c766771fd113a6b38cf8f908b 100644 (file)
@@ -76,7 +76,15 @@ local function rbl_cb (task)
                end
                task:inc_dns_req()
        end
-       
+
+       local sender_dns = task:get_hostname()
+       if sender_dns ~= nil then
+               for k,rbl in pairs(rbls) do
+                       if rbl['rdns'] then
+                               task:get_resolver():resolve_a(task:get_session(), task:get_mempool(), sender_dns .. '.' .. rbl['rbl'], rbl_dns_cb, k)
+                       end
+               end
+       end
        local rip = task:get_from_ip()
        if rip and (rip:to_string() ~= '0.0.0.0') then
                for k,rbl in pairs(rbls) do
@@ -132,8 +140,11 @@ end
 if(opts['default_unknown'] == nil) then
        opts['default_unknown'] = false
 end
+if(opts['default_rdns'] == nil) then
+        opts['default_rdns'] = false
+end
 for key,rbl in pairs(opts['rbls']) do
-       local o = { "ipv4", "ipv6", "from", "received", "unknown" }
+       local o = { "ipv4", "ipv6", "from", "received", "unknown", "rdns" }
        for i=1,table.maxn(o) do
                if(rbl[o[i]] == nil) then
                        rbl[o[i]] = opts['default_' .. o[i]]