From 0449b56df04b3d55e6f7d3738ae1040ba595af47 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 2 Nov 2022 21:17:01 +0000 Subject: [PATCH] [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; + } } } -- 2.39.5