]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Feature] Enable forced resolving for some lua plugins
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 13 Jun 2016 18:06:16 +0000 (19:06 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 13 Jun 2016 18:06:16 +0000 (19:06 +0100)
Issue: #661
Reported by: @FelixSchwarz

src/plugins/lua/dmarc.lua
src/plugins/lua/once_received.lua
src/plugins/lua/rbl.lua

index 063142f24070882def816939af03404e988c23ea..cb65a6875b66de897ba3619d3bc908207173e6a0 100644 (file)
@@ -80,7 +80,8 @@ local function dmarc_callback(task)
         task:get_resolver():resolve_txt({
           task=task,
           name = resolve_name,
-          callback = dmarc_dns_cb})
+          callback = dmarc_dns_cb,
+          forced = true})
         return
       end
 
@@ -182,7 +183,8 @@ local function dmarc_callback(task)
         task:get_resolver():resolve_txt({
           task=task,
           name = resolve_name,
-          callback = dmarc_dns_cb})
+          callback = dmarc_dns_cb,
+          forced = true})
 
         return
       else
@@ -263,7 +265,8 @@ local function dmarc_callback(task)
   task:get_resolver():resolve_txt({
     task=task,
     name = resolve_name,
-    callback = dmarc_dns_cb})
+    callback = dmarc_dns_cb,
+    forced = true})
 end
 
 local opts = rspamd_config:get_all_opt('dmarc')
index 341618429580c30979b68b68c166d4e2adc99054..63de22776be059cfe0b64165ca895ff83729daba 100644 (file)
@@ -80,7 +80,8 @@ local function check_quantity_received (task)
   if (not hn or hn == 'unknown') and task_ip and task_ip:is_valid() then
     task:get_resolver():resolve_ptr({task = task,
       name = task_ip:to_string(),
-      callback = recv_dns_cb
+      callback = recv_dns_cb,
+      forced = true
     })
     return
   end
index 91e20dc5b83774fc812134964990bed4da1744a8..2a004201960e7de26cb1a72849cb8676fb3924c7 100644 (file)
@@ -147,7 +147,8 @@ local function rbl_cb (task)
          task:get_resolver():resolve_a({task = task,
            name = havegot['helo'] .. '.' .. rbl['rbl'],
            callback = rbl_dns_cb,
-           option = k})
+           option = k,
+           forced = true})
        end)()
       end
 
@@ -173,7 +174,8 @@ local function rbl_cb (task)
             task:get_resolver():resolve_a({task = task,
               name = d .. '.' .. rbl['rbl'],
               callback = rbl_dns_cb,
-              option = k})
+              option = k,
+              forced = true})
           end
         end)()
       end
@@ -214,14 +216,16 @@ local function rbl_cb (task)
               task:get_resolver():resolve_a({task = task,
                 name = domain .. '.' .. rbl['rbl'],
                 callback = rbl_dns_cb,
-                option = k})
+                option = k,
+                forced = true})
             end
           else
             for _, email in pairs(havegot['emails']) do
               task:get_resolver():resolve_a({task = task,
                 name = email .. '.' .. rbl['rbl'],
                 callback = rbl_dns_cb,
-                option = k})
+                option = k,
+                forced = true})
             end
           end
         end)()
@@ -242,7 +246,8 @@ local function rbl_cb (task)
          task:get_resolver():resolve_a({task = task,
            name = havegot['rdns'] .. '.' .. rbl['rbl'],
            callback = rbl_dns_cb,
-           option = k})
+           option = k,
+           forced = true})
        end)()
       end
 
@@ -263,7 +268,8 @@ local function rbl_cb (task)
            task:get_resolver():resolve_a({task = task,
              name = ip_to_rbl(havegot['from'], rbl['rbl']),
              callback = rbl_dns_cb,
-             option = k})
+             option = k,
+             forced = true})
          end
        end)()
       end
@@ -287,10 +293,13 @@ local function rbl_cb (task)
                 ((rbl['exclude_private_ips'] and not rh['real_ip']:is_local()) or
                 not rbl['exclude_private_ips']) and ((rbl['exclude_local_ips'] and
                 not is_excluded_ip(rh['real_ip'])) or not rbl['exclude_local_ips']) then
+                  -- Disable forced for received resolving, as we have no control on
+                  -- those headers count
                   task:get_resolver():resolve_a({task = task,
                     name = ip_to_rbl(rh['real_ip'], rbl['rbl']),
                     callback = rbl_dns_cb,
-                    option = k})
+                    option = k,
+                    forced = false})
               end
            end
          end