commit 17b6bb6: [Minor] RBL: Add fail symbols

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Mar 22 12:21:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-03-22 11:06:51 +0000
URL: https://github.com/rspamd/rspamd/commit/17b6bb676433ddf1d2b69a2d6e01408ec67f2e15

[Minor] RBL: Add fail symbols
Issue: #2801

---
 src/plugins/lua/rbl.lua | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index 3bbf46ff3..5114ffeb9 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -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({


More information about the Commits mailing list