aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-29 14:26:00 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-29 14:26:00 +0100
commit63b57402425ed03017861e783068cfd7c2eb01ec (patch)
tree568d04b95972b41100506e6359d33757fc4febb7
parentb646ba7e23947356a0786ec2e60d8e4ec955b807 (diff)
downloadrspamd-63b57402425ed03017861e783068cfd7c2eb01ec.tar.gz
rspamd-63b57402425ed03017861e783068cfd7c2eb01ec.zip
[Fix] Rework settings actions in symbols cache
-rw-r--r--src/libserver/symbols_cache.c32
1 files changed, 2 insertions, 30 deletions
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c
index bd92ee782..3868a6198 100644
--- a/src/libserver/symbols_cache.c
+++ b/src/libserver/symbols_cache.c
@@ -975,33 +975,6 @@ rspamd_symbols_cache_validate (struct symbols_cache *cache,
return ret;
}
-static gboolean
-check_metric_settings (struct rspamd_task *task, struct metric *metric,
- double *score)
-{
- const ucl_object_t *mobj, *reject, *act;
- double val;
-
- if (task->settings == NULL) {
- return FALSE;
- }
-
- mobj = ucl_object_lookup (task->settings, metric->name);
- if (mobj != NULL) {
- act = ucl_object_lookup (mobj, "actions");
- if (act != NULL) {
- reject = ucl_object_lookup (act,
- rspamd_action_to_str (METRIC_ACTION_REJECT));
- if (reject != NULL && ucl_object_todouble_safe (reject, &val)) {
- *score = val;
- return TRUE;
- }
- }
- }
-
- return FALSE;
-}
-
/* Return true if metric has score that is more than spam score for it */
static gboolean
rspamd_symbols_cache_metric_limit (struct rspamd_task *task,
@@ -1027,9 +1000,8 @@ rspamd_symbols_cache_metric_limit (struct rspamd_task *task,
res = g_hash_table_lookup (task->results, metric->name);
if (res) {
- if (!check_metric_settings (task, metric, &ms)) {
- ms = metric->actions[METRIC_ACTION_REJECT].score;
- }
+
+ ms = res->actions_limits[METRIC_ACTION_REJECT];
if (!isnan (ms) && cp->lim < ms) {
cp->rs = res;