diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-01-29 14:40:25 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-01-29 14:40:25 +0000 |
commit | f3ce044e0892718c69017d7d16c1ebeceffedcf1 (patch) | |
tree | 1feca8c5d982b550bf9162a9d785d06ba42e0346 /src/libmime/scan_result.c | |
parent | dc74baf9e938243962617313464e3a24805fcb2c (diff) | |
download | rspamd-f3ce044e0892718c69017d7d16c1ebeceffedcf1.tar.gz rspamd-f3ce044e0892718c69017d7d16c1ebeceffedcf1.zip |
[Minor] Fix shadow results chaining
Diffstat (limited to 'src/libmime/scan_result.c')
-rw-r--r-- | src/libmime/scan_result.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/libmime/scan_result.c b/src/libmime/scan_result.c index 63e1de298..b75dddb1f 100644 --- a/src/libmime/scan_result.c +++ b/src/libmime/scan_result.c @@ -194,7 +194,8 @@ insert_metric_result (struct rspamd_task *task, double weight, const gchar *opt, struct rspamd_scan_result *metric_res, - enum rspamd_symbol_insert_flags flags) + enum rspamd_symbol_insert_flags flags, + bool *new_sym) { struct rspamd_symbol_result *s = NULL; gdouble final_score, *gr_score = NULL, next_gf = 1.0, diff; @@ -390,6 +391,10 @@ insert_metric_result (struct rspamd_task *task, } else { /* New result */ + if (new_sym) { + *new_sym = true; + } + sym_cpy = rspamd_mempool_strdup (task->task_pool, symbol); k = kh_put (rspamd_symbols_hash, metric_res->symbols, sym_cpy, &ret); @@ -530,13 +535,15 @@ rspamd_task_insert_result_full (struct rspamd_task *task, } } - s = NULL; + bool new_symbol = false; + s = insert_metric_result (task, symbol, weight, opt, mres, - flags); + flags, + &new_symbol); if (mres->name == NULL) { /* Default result */ @@ -548,7 +555,7 @@ rspamd_task_insert_result_full (struct rspamd_task *task, s->sym->cache_item); } } - else { + else if (new_symbol) { /* O(N) but we normally don't have any shadow results */ LL_APPEND (ret, s); } @@ -561,7 +568,8 @@ rspamd_task_insert_result_full (struct rspamd_task *task, weight, opt, result, - flags); + flags, + NULL); ret = s; if (result->name == NULL) { @@ -697,6 +705,7 @@ rspamd_task_add_result_option (struct rspamd_task *task, /* Cannot add more options, give up */ msg_debug_task ("cannot add more options to symbol %s when adding option %s", cur->name, val); + ret = FALSE; continue; } |