commit e01c11d: [Fix] Fix ignored symbols exporting

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Feb 3 11:49:05 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-02-03 11:45:57 +0000
URL: https://github.com/rspamd/rspamd/commit/e01c11d2ae6c22283bce8c25eeadeefdec11fd3e (HEAD -> master)

[Fix] Fix ignored symbols exporting

---
 src/lua/lua_task.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 0b5fab09e..3855c3cc4 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -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 {


More information about the Commits mailing list