]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Multimap: support adding map values as extra options 3561/head
authorAndrew Lewis <nerf@judo.za.org>
Wed, 25 Nov 2020 12:55:18 +0000 (14:55 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Wed, 25 Nov 2020 13:03:00 +0000 (15:03 +0200)
src/plugins/lua/multimap.lua
test/functional/cases/102_multimap.robot
test/functional/configs/multimap.conf

index 109f974cd5f6ce324eb2c59a55e676b9fea357c0..7faaaf265950f1be955657fa66aa64361d99d439 100644 (file)
@@ -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
index 701714264bea6d7f99483476efd0a761d19f05d1..fc93d7565da7cbe905d4cb8a865e80c004255df5 100644 (file)
@@ -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@example.com
+  Expect Symbol With Exact Options  RCPT_MAP_NOMULTISYM  user3@example.com  SYM1
+
 *** Keywords ***
 Multimap Setup
   ${PLUGIN_CONFIG} =  Get File  ${TESTDIR}/configs/multimap.conf
index d4fad0e16d14ff08ccd2d40194b61bddcc65ce94..9158f657c891ebeb9bf18d934ddad9cda2111f3c 100644 (file)
@@ -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";