aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-05-21 19:46:35 +0600
committerGitHub <noreply@github.com>2024-05-21 19:46:35 +0600
commit08990def9860c586d9d9ec5a4e9865e3a9747aa4 (patch)
treeda37c966402d8fea318bf6e1407f854aa0367326
parentbc3bbaa6c769ddfbf5d6d614687300e21d8649f3 (diff)
parent448227d177665627568af19fe5dc2a09b5f55416 (diff)
downloadrspamd-08990def9860c586d9d9ec5a4e9865e3a9747aa4.tar.gz
rspamd-08990def9860c586d9d9ec5a4e9865e3a9747aa4.zip
Merge pull request #4976 from rspamd/vstakhov-fix-multimap-multisym
Fix multimaps with dynamic symbols
-rw-r--r--src/plugins/lua/multimap.lua4
-rw-r--r--test/functional/cases/001_merged/102_multimap.robot4
-rw-r--r--test/functional/configs/maps/dynamic_symbols.map4
-rw-r--r--test/functional/configs/merged-override.conf1
4 files changed, 7 insertions, 6 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index 600a09c4f..c67b3ddbe 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -1124,7 +1124,7 @@ local function multimap_on_load_gen(rule)
lua_util.debugm(N, rspamd_config, "%s: adding new symbol %s (score = %s), triggered by %s",
rule.symbol, symbol, score, key)
rspamd_config:register_symbol {
- name = value,
+ name = symbol,
parent = rule.callback_id,
type = 'virtual',
score = score,
@@ -1133,7 +1133,7 @@ local function multimap_on_load_gen(rule)
group = N,
score = 1.0, -- In future, we will parse score from `get_value` and use it as multiplier
description = 'Automatic symbol generated by rule: ' .. rule.symbol,
- name = value,
+ name = symbol,
})
known_symbols[value] = true
end
diff --git a/test/functional/cases/001_merged/102_multimap.robot b/test/functional/cases/001_merged/102_multimap.robot
index 135f5ce34..8e9d83d42 100644
--- a/test/functional/cases/001_merged/102_multimap.robot
+++ b/test/functional/cases/001_merged/102_multimap.robot
@@ -420,13 +420,13 @@ MAP - EXTERNAL MISS
MAP - DYNAMIC SYMBOLS - SYM1
Scan File ${MESSAGE} IP=127.0.0.1 Hostname=foo
... Settings={symbols_enabled = [DYN_TEST1,DYN_TEST2,DYN_MULTIMAP]}
- Expect Symbol DYN_TEST1
+ Expect Symbol With Score DYN_TEST1 10
Do Not Expect Symbol DYN_TEST2
MAP - DYNAMIC SYMBOLS - SYM2
Scan File ${MESSAGE} IP=127.0.0.1 Hostname=bar
... Settings={symbols_enabled = [DYN_TEST1,DYN_TEST2,DYN_MULTIMAP]}
- Expect Symbol DYN_TEST2
+ Expect Symbol With Score DYN_TEST2 20
Do Not Expect Symbol DYN_TEST1
MAP - DYNAMIC SYMBOLS - MISS
diff --git a/test/functional/configs/maps/dynamic_symbols.map b/test/functional/configs/maps/dynamic_symbols.map
index ec92c74af..e517d5638 100644
--- a/test/functional/configs/maps/dynamic_symbols.map
+++ b/test/functional/configs/maps/dynamic_symbols.map
@@ -1,2 +1,2 @@
-foo DYN_TEST1:10:opt1,opt2
-bar DYN_TEST2:20:opt3,opt4
+/foo/ DYN_TEST1:10:opt1,opt2
+/bar/ DYN_TEST2:20:opt3,opt4
diff --git a/test/functional/configs/merged-override.conf b/test/functional/configs/merged-override.conf
index 09ac00584..35f22630f 100644
--- a/test/functional/configs/merged-override.conf
+++ b/test/functional/configs/merged-override.conf
@@ -252,6 +252,7 @@ multimap {
type = "hostname";
map = "{= env.TESTDIR =}/configs/maps/dynamic_symbols.map";
dynamic_symbols = true;
+ regexp = true;
}
}