summaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-02 11:45:25 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-02 11:45:57 +0000
commite85ab6fd9a60926020d04783c31d397209804196 (patch)
tree5f07c085de126d2c2e488b8a5ecaf3fd6f4ad055 /src/libmime
parent3a8c48e8c90c7d068135fd7df0edcfade6ac9b6d (diff)
downloadrspamd-e85ab6fd9a60926020d04783c31d397209804196.tar.gz
rspamd-e85ab6fd9a60926020d04783c31d397209804196.zip
[Fix] Fix prefilters action scores
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/filter.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/libmime/filter.c b/src/libmime/filter.c
index cffa9e215..8b4b30534 100644
--- a/src/libmime/filter.c
+++ b/src/libmime/filter.c
@@ -357,21 +357,29 @@ rspamd_check_action_metric (struct rspamd_task *task, struct rspamd_metric_resul
}
else {
i = task->pre_result.action;
- selected_action = &mres->metric->actions[i];
- sc = mres->actions_limits[i];
- while (isnan (sc)) {
- i = (i + 1) % METRIC_ACTION_MAX;
+ for (i = task->pre_result.action; i < METRIC_ACTION_MAX; i ++) {
+ selected_action = &mres->metric->actions[i];
sc = mres->actions_limits[i];
- if (i == task->pre_result.action) {
- /* No scores defined, just avoid NaN */
- sc = 0;
+ if (isnan (sc)) {
+ if (i == task->pre_result.action) {
+ /* No scores defined, just avoid NaN */
+ sc = 0;
+ break;
+ }
+ }
+ else {
break;
}
}
- mres->score = sc;
+ if (!isnan (sc)) {
+ mres->score = sc;
+ }
+ else {
+ mres->score = 0;
+ }
}
if (selected_action) {