diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-02-20 21:35:41 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-02-20 21:35:41 +0000 |
commit | 7e4aa922ca608d4567c5e9c775bbe614a4e72566 (patch) | |
tree | 58c3b70ae2c446cc9d164c9fa119c9e2f5e2e3fb /src/libmime/scan_result.c | |
parent | 1432a7af36901e9cb5243b5d83a377656728896e (diff) | |
download | rspamd-7e4aa922ca608d4567c5e9c775bbe614a4e72566.tar.gz rspamd-7e4aa922ca608d4567c5e9c775bbe614a4e72566.zip |
[Fix] Fix smtp message on passthrough result
Issue: #3269
Diffstat (limited to 'src/libmime/scan_result.c')
-rw-r--r-- | src/libmime/scan_result.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/libmime/scan_result.c b/src/libmime/scan_result.c index babf80abe..8242c7de2 100644 --- a/src/libmime/scan_result.c +++ b/src/libmime/scan_result.c @@ -669,12 +669,13 @@ rspamd_task_add_result_option (struct rspamd_task *task, } struct rspamd_action* -rspamd_check_action_metric (struct rspamd_task *task) +rspamd_check_action_metric (struct rspamd_task *task, + struct rspamd_passthrough_result **ppr) { struct rspamd_action_result *action_lim, *noaction = NULL; struct rspamd_action *selected_action = NULL, *least_action = NULL; - struct rspamd_passthrough_result *pr; + struct rspamd_passthrough_result *pr, *sel_pr = NULL; double max_score = -(G_MAXDOUBLE), sc; int i; struct rspamd_scan_result *mres = task->result; @@ -696,6 +697,10 @@ rspamd_check_action_metric (struct rspamd_task *task) } } + if (ppr) { + *ppr = pr; + } + return selected_action; } else { @@ -721,10 +726,12 @@ rspamd_check_action_metric (struct rspamd_task *task) else { sc = selected_action->threshold; max_score = sc; + sel_pr = pr; } } else { max_score = sc; + sel_pr = pr; } } } @@ -767,17 +774,31 @@ rspamd_check_action_metric (struct rspamd_task *task) selected_action->action_type != METRIC_ACTION_DISCARD) { /* Override score based action with least action */ selected_action = least_action; + + if (ppr) { + *ppr = sel_pr; + } } } else { /* Adjust score if needed */ - mres->score = MAX (max_score, mres->score); + if (max_score > mres->score) { + if (ppr) { + *ppr = sel_pr; + } + + mres->score = max_score; + } } } return selected_action; } + if (ppr) { + *ppr = sel_pr; + } + return noaction->action; } |