commit 2d98756: [Fix] Lua_task: Fix deleted symbols in has_symbol/get_symbol
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Feb 15 21:28:07 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-02-15 21:22:34 +0000
URL: https://github.com/rspamd/rspamd/commit/2d9875672ffe739d00ffb6a072eb9536ffdae3b3 (HEAD -> master)
[Fix] Lua_task: Fix deleted symbols in has_symbol/get_symbol
---
src/lua/lua_task.c | 17 +++++++++++++----
1 file 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);
}
More information about the Commits
mailing list