commit 6541d1c: [Minor] Add more default scores :(

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Jun 15 10:28:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-06-15 11:24:21 +0100
URL: https://github.com/rspamd/rspamd/commit/6541d1c6925d3cda8b2f1751445b409fde28c768 (HEAD -> master)

[Minor] Add more default scores :(

---
 src/plugins/lua/multimap.lua     |  3 ++-
 src/plugins/lua/spamassassin.lua | 20 ++++++++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index f82a4fb38..1ef2dbe12 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -1260,7 +1260,8 @@ if opts and type(opts) == 'table' then
         rspamd_config:register_symbol({
           type = 'virtual',
           name = s,
-          parent = id
+          parent = id,
+          score = 0, -- Default score
         })
         rule['symbols_set'][s] = 1
       end, rule['symbols'])
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua
index 4ebe588b4..f69c5aa66 100644
--- a/src/plugins/lua/spamassassin.lua
+++ b/src/plugins/lua/spamassassin.lua
@@ -1532,6 +1532,7 @@ local function post_process()
       if not expression then
         rspamd_logger.errx(rspamd_config, 'Cannot parse expression ' .. r['meta'])
       else
+
         if r['score'] then
           rspamd_config:set_metric_symbol{
             name = k, score = r['score'],
@@ -1540,14 +1541,21 @@ local function post_process()
             one_shot = true
           }
           scores_added[k] = 1
+          rspamd_config:register_symbol{
+            name = k,
+            weight = calculate_score(k, r),
+            callback = meta_cb
+          }
+        else
+          -- Add 0 score to avoid issues
+          rspamd_config:register_symbol{
+            name = k,
+            weight = calculate_score(k, r),
+            callback = meta_cb,
+            score = 0,
+          }
         end
 
-        rspamd_config:register_symbol{
-          name = k,
-          weight = calculate_score(k, r),
-          callback = meta_cb
-        }
-
         r['expression'] = expression
 
         if not atoms[k] then


More information about the Commits mailing list