diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-24 14:46:34 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-24 14:51:01 +0100 |
commit | e1d468b23b883530b7e586d3542af1baf5e09272 (patch) | |
tree | 35401ac28a25e06e7dd68d15c3d07a88605e2626 | |
parent | e451f51d937a8bba2b4b0a2cb1abe92ba70eb2d2 (diff) | |
download | rspamd-e1d468b23b883530b7e586d3542af1baf5e09272.tar.gz rspamd-e1d468b23b883530b7e586d3542af1baf5e09272.zip |
Tune group max score limit.
-rw-r--r-- | src/libmime/filter.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libmime/filter.c b/src/libmime/filter.c index e734c25d9..7562cee94 100644 --- a/src/libmime/filter.c +++ b/src/libmime/filter.c @@ -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)) |