diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-02-15 21:22:34 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-02-15 21:22:34 +0000 |
commit | 2d9875672ffe739d00ffb6a072eb9536ffdae3b3 (patch) | |
tree | 435b894f8b6700bb293d1ce7d06f319786d4e72b /src/lua | |
parent | 138b26b184a2e73350b0ba2d7cdbf0def3c30734 (diff) | |
download | rspamd-2d9875672ffe739d00ffb6a072eb9536ffdae3b3.tar.gz rspamd-2d9875672ffe739d00ffb6a072eb9536ffdae3b3.zip |
[Fix] Lua_task: Fix deleted symbols in has_symbol/get_symbol
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_task.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 3bd84d886..31694df36 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -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); } |