]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] RBL: Add fail symbols
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 22 Mar 2019 11:06:51 +0000 (11:06 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 22 Mar 2019 11:06:51 +0000 (11:06 +0000)
Issue: #2801

src/plugins/lua/rbl.lua

index 3bbf46ff3d313d3460c852e5061efa6bf6f7cdec..5114ffeb9b4e94d0cf28e2322b2fc85440642f7c 100644 (file)
@@ -159,8 +159,12 @@ end
 local function rbl_dns_process(task, rbl, to_resolve, results, err)
   if err and (err ~= 'requested record is not found' and
       err ~= 'no records with this name') then
-    rspamd_logger.errx(task, 'error looking up %s: %s', to_resolve, err)
+    rspamd_logger.infox(task, 'error looking up %s: %s', to_resolve, err)
+    task:insert_result(rbl.symbol .. '_FAIL', 1, string.format('%s:%s',
+        to_resolve, err))
+    return
   end
+
   if not results then
     lua_util.debugm(N, task,
         'DNS RESPONSE: label=%1 results=%2 error=%3 rbl=%4',
@@ -554,6 +558,14 @@ local function add_rbl(key, rbl)
     rspamd_config:register_dependency(rbl.symbol, 'DKIM_CHECK')
   end
 
+  -- Failure symbol
+  rspamd_config:register_symbol{
+    type = 'virtual',
+    name = rbl.symbol .. '_FAIL',
+    parent = id,
+    score = 0.0,
+  }
+
   if rbl.returncodes then
     for s,_ in pairs(rbl['returncodes']) do
       rspamd_config:register_symbol({