]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Spamassassin: Exclude symbol name from options
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 23 Oct 2019 11:39:34 +0000 (12:39 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 23 Oct 2019 11:39:34 +0000 (12:39 +0100)
src/plugins/lua/spamassassin.lua

index 2e34201a4039bc9cbb154ef94cda65c2b55d7152..2ba0b6228a5a9e36d48779d390616f463064c561 100644 (file)
@@ -1466,14 +1466,19 @@ local function post_process()
         local res = 0
         local trace = {}
         -- XXX: need to memoize result for better performance
-        local sym = task:has_symbol(k)
-        if not sym then
+        local has_sym = task:has_symbol(k)
+        if not has_sym then
           if expression then
             res,trace = expression:process_traced(task)
           end
           if res > 0 then
             -- Symbol should be one shot to make it working properly
-            task:insert_result(k, res, trace)
+
+            -- Exclude elements that are named in the same way as the symbol itself
+            local function exclude_sym_filter(sopt)
+              return sopt ~= k
+            end
+            task:insert_result(k, res, fun.totable(fun.filter(exclude_sym_filter, trace)))
           end
         else
           res = 1