]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix ignored symbols exporting
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 3 Feb 2020 11:45:57 +0000 (11:45 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 3 Feb 2020 11:46:34 +0000 (11:46 +0000)
src/lua/lua_task.c

index 0b5fab09e7c03e01d39fe98bede5268dd51b73e6..3855c3cc478a5076db5e16517b9c7d560a73954e 100644 (file)
@@ -4586,8 +4586,10 @@ lua_task_get_symbols_all (lua_State *L)
                        lua_createtable (L, kh_size (mres->symbols), 0);
 
                        kh_foreach_value_ptr (mres->symbols, s, {
-                               lua_push_symbol_result (L, task, s->name, s, FALSE, TRUE);
-                               lua_rawseti (L, -2, i++);
+                               if (!(s->flags & RSPAMD_SYMBOL_RESULT_IGNORED)) {
+                                       lua_push_symbol_result (L, task, s->name, s, FALSE, TRUE);
+                                       lua_rawseti (L, -2, i++);
+                               }
                        });
                }
        }
@@ -4708,11 +4710,16 @@ tokens_foreach_cb (struct rspamd_symcache_item *item, gpointer ud)
        }
 
        if ((s = rspamd_task_find_symbol_result (cbd->task, sym)) != NULL) {
-               if (cbd->normalize) {
-                       lua_pushnumber (cbd->L, tanh (s->score));
+               if (s->flags & RSPAMD_SYMBOL_RESULT_IGNORED) {
+                       lua_pushnumber (cbd->L, 0.0);
                }
                else {
-                       lua_pushnumber (cbd->L, s->score);
+                       if (cbd->normalize) {
+                               lua_pushnumber (cbd->L, tanh (s->score));
+                       }
+                       else {
+                               lua_pushnumber (cbd->L, s->score);
+                       }
                }
        }
        else {