commit 68cb5ea: [Feature] Multimap: support adding map values as extra options
Andrew Lewis
nerf at judo.za.org
Sat Nov 28 22:35:06 UTC 2020
Author: Andrew Lewis
Date: 2020-11-25 14:55:18 +0200
URL: https://github.com/rspamd/rspamd/commit/68cb5ea8c9b0b6437a60f1deb84b62691b0b62bc (refs/pull/3561/head)
[Feature] Multimap: support adding map values as extra options
---
src/plugins/lua/multimap.lua | 9 +++++++++
test/functional/cases/102_multimap.robot | 4 ++++
test/functional/configs/multimap.conf | 7 +++++++
3 files changed, 20 insertions(+)
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index 109f974cd..7faaaf265 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -561,6 +561,15 @@ local function multimap_callback(task, rule)
symbol, rule.symbol, rule.symbol)
symbol = rule.symbol
end
+ elseif rule.disable_multisymbol then
+ symbol = rule.symbol
+ if type(opt) == 'table' then
+ table.insert(opt, result)
+ elseif type(opt) ~= nil then
+ opt = {opt,result}
+ else
+ opt = {result}
+ end
else
forced = true
end
diff --git a/test/functional/cases/102_multimap.robot b/test/functional/cases/102_multimap.robot
index 701714264..fc93d7565 100644
--- a/test/functional/cases/102_multimap.robot
+++ b/test/functional/cases/102_multimap.robot
@@ -332,6 +332,10 @@ FREEMAIL_CC
Scan File ${FREEMAIL_CC}
Expect Symbol With Score And Exact Options FREEMAIL_CC 19.00 test.com test1.com test2.com test3.com test4.com test5.com test6.com test7.com test8.com test9.com test10.com test11.com test12.com test13.com test14.com
+MAP - MULTISYMBOL DISABLED
+ Scan File ${MESSAGE} Rcpt=user3 at example.com
+ Expect Symbol With Exact Options RCPT_MAP_NOMULTISYM user3 at example.com SYM1
+
*** Keywords ***
Multimap Setup
${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/multimap.conf
diff --git a/test/functional/configs/multimap.conf b/test/functional/configs/multimap.conf
index d4fad0e16..9158f657c 100644
--- a/test/functional/configs/multimap.conf
+++ b/test/functional/configs/multimap.conf
@@ -56,6 +56,13 @@ multimap {
map = "${TESTDIR}/configs/maps/multiple.list";
score = 1.0;
}
+ RCPT_MAP_NOMULTISYM {
+ type = "rcpt";
+ filter = "email:addr";
+ disable_multisymbol = true;
+ map = "${TESTDIR}/configs/maps/multiple.list";
+ score = 1.0;
+ }
HEADER_MAP {
type = "header";
header = "To";
More information about the Commits
mailing list