]> source.dussan.org Git - rspamd.git/commitdiff
Tune group max score limit.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 24 Apr 2015 13:46:34 +0000 (14:46 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 24 Apr 2015 13:51:01 +0000 (14:51 +0100)
src/libmime/filter.c

index e734c25d959b2be13a636963eb54734ace4f53d7..7562cee94299350af62886ed7334411463e6d7ae 100644 (file)
@@ -165,14 +165,17 @@ insert_metric_result (struct rspamd_task *task,
 
        /* XXX: does not take grow factor into account */
        if (gr != NULL && gr_score != NULL && gr->max_score > 0.0) {
-               *gr_score += w;
-
-               if (*gr_score > gr->max_score) {
+               if (*gr_score >= gr->max_score) {
                        msg_info ("maximum group score %.2f for group %s has been reached,"
                                        " ignoring symbol %s with weight %.2f", gr->max_score,
                                        gr->name, symbol, w);
                        return;
                }
+               else if (*gr_score + w > gr->max_score) {
+                       w = gr->max_score - *gr_score;
+               }
+
+               *gr_score += w;
        }
 
        /* Add metric score */
@@ -247,7 +250,6 @@ insert_metric_result (struct rspamd_task *task,
                s->score,
                metric->name,
                w);
-
 }
 
 #if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION <= 30))