]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Lua_task: Fix deleted symbols in has_symbol/get_symbol
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 15 Feb 2021 21:22:34 +0000 (21:22 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 15 Feb 2021 21:22:34 +0000 (21:22 +0000)
src/lua/lua_task.c

index 3bd84d8860068ba24591ed403ede5a1ac1497755..31694df36b11f7869e388f2cee77f019b2fd719b 100644 (file)
@@ -4465,7 +4465,7 @@ lua_push_symbol_result (lua_State *L,
                s = symbol_result;
        }
 
-       if (s) {
+       if (s && !(s->flags & RSPAMD_SYMBOL_RESULT_IGNORED)) {
                if (add_metric) {
                        table_fields_cnt++;
                }
@@ -4573,6 +4573,7 @@ lua_task_has_symbol (lua_State *L)
 {
        LUA_TRACE_POINT;
        struct rspamd_task *task = lua_check_task (L, 1);
+       struct rspamd_symbol_result *s;
        const gchar *symbol;
        gboolean found = FALSE;
 
@@ -4580,11 +4581,19 @@ lua_task_has_symbol (lua_State *L)
 
        if (task && symbol) {
                if (lua_isstring (L, 3)) {
-                       found = (rspamd_task_find_symbol_result (task, symbol,
-                                       rspamd_find_metric_result (task, lua_tostring (L, 3))) != NULL);
+                       s = rspamd_task_find_symbol_result (task, symbol,
+                                       rspamd_find_metric_result (task, lua_tostring (L, 3)));
+
+                       if (s && !(s->flags & RSPAMD_SYMBOL_RESULT_IGNORED)) {
+                               found = TRUE;
+                       }
                }
                else {
-                       found = (rspamd_task_find_symbol_result (task, symbol, NULL) != NULL);
+                       s = rspamd_task_find_symbol_result (task, symbol, NULL);
+
+                       if (s && !(s->flags & RSPAMD_SYMBOL_RESULT_IGNORED)) {
+                               found = TRUE;
+                       }
                }
                lua_pushboolean (L, found);
        }