From: Vsevolod Stakhov Date: Wed, 2 Nov 2022 21:17:01 +0000 (+0000) Subject: [Fix] Honor group flag for one shot X-Git-Tag: 3.5~225 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0449b56df04b3d55e6f7d3738ae1040ba595af47;p=rspamd.git [Fix] Honor group flag for one shot --- 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; + } } }