]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Honor group flag for one shot
authorVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 2 Nov 2022 21:17:01 +0000 (21:17 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 2 Nov 2022 21:18:31 +0000 (21:18 +0000)
src/libmime/scan_result.c

index 33cac5f70c359eccffb13c3872a8209cc0e90eb8..137f30ca0234f60fe0c8520731248f7572f080df 100644 (file)
@@ -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;
+                               }
                        }
                }