aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-04-29 11:41:28 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-04-29 11:41:28 +0100
commit1e6a1fecc70b723109f9e7ec1b8da1acd744861c (patch)
treefaea28faa9c502ccb93002561ecab2d3127385fc
parenta1c156778f4764114bc0b178d646b9882fcf9916 (diff)
downloadrspamd-1e6a1fecc70b723109f9e7ec1b8da1acd744861c.tar.gz
rspamd-1e6a1fecc70b723109f9e7ec1b8da1acd744861c.zip
[Minor] Some fixes in least passthrough results processing
-rw-r--r--src/libmime/filter.c40
-rw-r--r--src/lua/lua_task.c13
2 files changed, 32 insertions, 21 deletions
diff --git a/src/libmime/filter.c b/src/libmime/filter.c
index c3f3089f8..a454cb8df 100644
--- a/src/libmime/filter.c
+++ b/src/libmime/filter.c
@@ -503,25 +503,33 @@ rspamd_check_action_metric (struct rspamd_task *task)
gboolean seen_least = FALSE;
if (mres->passthrough_result != NULL) {
- /* Peek the highest priority result */
- pr = mres->passthrough_result;
- sc = pr->target_score;
- selected_action = pr->action;
-
- if (!(pr->flags & RSPAMD_PASSTHROUGH_LEAST)) {
- if (!isnan (sc)) {
- if (pr->action->action_type == METRIC_ACTION_NOACTION) {
- mres->score = MIN (sc, mres->score);
+ DL_FOREACH (mres->passthrough_result, pr) {
+ if (!seen_least || !(pr->flags & RSPAMD_PASSTHROUGH_LEAST)) {
+ sc = pr->target_score;
+ selected_action = pr->action;
+
+ if (!(pr->flags & RSPAMD_PASSTHROUGH_LEAST)) {
+ if (!isnan (sc)) {
+ if (pr->action->action_type == METRIC_ACTION_NOACTION) {
+ mres->score = MIN (sc, mres->score);
+ }
+ else {
+ mres->score = sc;
+ }
+ }
+
+ return selected_action;
}
else {
- mres->score = sc;
+ seen_least = true;
+
+ if (isnan (sc)) {
+ sc = selected_action->threshold;
+ }
+
+ max_score = sc;
}
}
-
- return selected_action;
- }
- else {
- seen_least = true;
}
}
/* We are not certain about the results during processing */
@@ -555,7 +563,7 @@ rspamd_check_action_metric (struct rspamd_task *task)
if (selected_action) {
if (seen_least) {
- mres->score = MIN (sc, mres->score);
+ mres->score = MAX (max_score, mres->score);
}
return selected_action;
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 6a4ae145d..6a6413e7f 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -1809,11 +1809,14 @@ lua_task_set_pre_result (lua_State * L)
if (lua_type (L, 3) == LUA_TSTRING) {
message = lua_tostring (L, 3);
- /* Keep compatibility here :( */
- ucl_object_replace_key (task->messages,
- ucl_object_fromstring_common (message, 0, UCL_STRING_RAW),
- "smtp_message", 0,
- false);
+ if (lua_type (L, 7) != LUA_TSTRING) {
+ /* Keep compatibility here :( */
+
+ ucl_object_replace_key (task->messages,
+ ucl_object_fromstring_common (message, 0, UCL_STRING_RAW),
+ "smtp_message", 0,
+ false);
+ }
}
else {
message = "unknown reason";