]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Add implicit score for rbl and multimap rules
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 12 Jun 2020 15:16:11 +0000 (16:16 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 12 Jun 2020 15:16:11 +0000 (16:16 +0100)
src/plugins/lua/multimap.lua
src/plugins/lua/rbl.lua

index c3225ff254828b16ac4fd6daee02df555c5b93ad..f82a4fb38e38d10bc5b7da02969b689fb8fa0d05 100644 (file)
@@ -1265,6 +1265,10 @@ if opts and type(opts) == 'table' then
         rule['symbols_set'][s] = 1
       end, rule['symbols'])
     end
+    if not rule.score then
+      rspamd_logger.infox(rspamd_config, 'set default score 0 for multimap rule %s', rule.symbol)
+      rule.score = 0
+    end
     if rule['score'] then
       -- Register metric symbol
       rule.name = rule.symbol
@@ -1275,11 +1279,13 @@ if opts and type(opts) == 'table' then
     end
   end, fun.filter(function(r) return not r['prefilter'] end, rules))
 
-  fun.each(function(r)
+  -- prefilter symbils
+  fun.each(function(rule)
     rspamd_config:register_symbol({
       type = 'prefilter',
-      name = r['symbol'],
-      callback = gen_multimap_callback(r),
+      name = rule['symbol'],
+      score = rule.score or 0,
+      callback = gen_multimap_callback(rule),
     })
   end, fun.filter(function(r) return r['prefilter'] end, rules))
 
index d299575ee81b4803e70a28f160c222e5d1ec6b7f..f0165c4abef5a50f9c5e678151b3b7aa7a7005a9 100644 (file)
@@ -954,6 +954,8 @@ local function add_rbl(key, rbl, global_opts)
         rspamd_config:register_symbol{
           type = 'virtual',
           parent = id,
+          group = 'rbl',
+          score = 0,
           name = prefix .. '_' .. rbl.symbol,
         }
       end
@@ -969,6 +971,8 @@ local function add_rbl(key, rbl, global_opts)
         type = 'callback',
         callback = callback,
         name = rbl.symbol,
+        group = 'rbl',
+        score = 0,
         flags = table.concat(flags_tbl, ',')
       }
       if not (rbl.is_whitelist or rbl.ignore_whitelist) then
@@ -1008,6 +1012,8 @@ local function add_rbl(key, rbl, global_opts)
             type = 'virtual',
             parent = id,
             name = s,
+            group = 'rbl',
+            score = 0,
           }
         end
         if rbl.is_whitelist then