aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libmime/scan_result.c2
-rw-r--r--src/libmime/scan_result.h3
-rw-r--r--src/libserver/symcache/symcache_runtime.cxx23
3 files changed, 27 insertions, 1 deletions
diff --git a/src/libmime/scan_result.c b/src/libmime/scan_result.c
index d5c03b2c4..e628eb1f3 100644
--- a/src/libmime/scan_result.c
+++ b/src/libmime/scan_result.c
@@ -806,7 +806,7 @@ rspamd_task_add_result_option (struct rspamd_task *task,
return ret;
}
-static struct rspamd_action_config *
+struct rspamd_action_config *
rspamd_find_action_config_for_action (struct rspamd_scan_result *scan_result,
struct rspamd_action *act)
{
diff --git a/src/libmime/scan_result.h b/src/libmime/scan_result.h
index 2f982fd1b..ec0aa9f4d 100644
--- a/src/libmime/scan_result.h
+++ b/src/libmime/scan_result.h
@@ -224,6 +224,9 @@ struct rspamd_action *rspamd_check_action_metric (struct rspamd_task *task,
struct rspamd_passthrough_result **ppr,
struct rspamd_scan_result *scan_result);
+struct rspamd_action_config *rspamd_find_action_config_for_action (struct rspamd_scan_result *scan_result,
+ struct rspamd_action *act);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/libserver/symcache/symcache_runtime.cxx b/src/libserver/symcache/symcache_runtime.cxx
index 1bcebbdc7..4bfa99529 100644
--- a/src/libserver/symcache/symcache_runtime.cxx
+++ b/src/libserver/symcache/symcache_runtime.cxx
@@ -20,6 +20,7 @@
#include "libutil/cxx/util.hxx"
#include "libserver/task.h"
#include "libmime/scan_result.h"
+#include "utlist.h"
#include "libserver/worker_util.h"
#include <limits>
#include <cmath>
@@ -525,6 +526,28 @@ symcache_runtime::check_metric_limit(struct rspamd_task *task) -> bool
}
}
+ if (task->result->passthrough_result != nullptr) {
+ /* We also need to check passthrough results */
+ auto *pr = task->result->passthrough_result;
+ DL_FOREACH (task->result->passthrough_result, pr) {
+ struct rspamd_action_config *act_config =
+ rspamd_find_action_config_for_action(task->result, pr->action);
+
+ /* Skip least results */
+ if (pr->flags & RSPAMD_PASSTHROUGH_LEAST) {
+ continue;
+ }
+
+ /* Skip disabled actions */
+ if (act_config && (act_config->flags & RSPAMD_ACTION_RESULT_DISABLED)) {
+ continue;
+ }
+
+ /* Immediately stop on non least passthrough action */
+ return true;
+ }
+ }
+
return false;
}