commit 0449b56: [Fix] Honor group flag for one shot
Vsevolod Stakhov
vsevolod at rspamd.com
Wed Nov 2 21:21:04 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-11-02 21:17:01 +0000
URL: https://github.com/rspamd/rspamd/commit/0449b56df04b3d55e6f7d3738ae1040ba595af47 (HEAD -> master)
[Fix] Honor group flag for one shot
---
src/libmime/scan_result.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/libmime/scan_result.c b/src/libmime/scan_result.c
index 33cac5f70..137f30ca0 100644
--- a/src/libmime/scan_result.c
+++ b/src/libmime/scan_result.c
@@ -236,7 +236,7 @@ insert_metric_result (struct rspamd_task *task,
struct rspamd_symbol *sdef;
struct rspamd_symbols_group *gr = NULL;
const ucl_object_t *mobj, *sobj;
- gint max_shots, ret;
+ gint max_shots = G_MAXINT, ret;
guint i;
khiter_t k;
gboolean single = !!(flags & RSPAMD_SYMBOL_INSERT_SINGLE);
@@ -322,7 +322,16 @@ insert_metric_result (struct rspamd_task *task,
max_shots = sdef->nshots;
}
else {
- max_shots = task->cfg->default_max_shots;
+ if (sdef->groups) {
+ PTR_ARRAY_FOREACH(sdef->groups, i, gr) {
+ if (gr->flags & RSPAMD_SYMBOL_GROUP_ONE_SHOT) {
+ max_shots = 1;
+ }
+ }
+ }
+ else {
+ max_shots = task->cfg->default_max_shots;
+ }
}
}
More information about the Commits
mailing list