summaryrefslogtreecommitdiffstats
path: root/src/libserver/cfg_rcl.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-15 17:35:16 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-15 17:35:16 +0100
commit3262b2b175bb5de9eb3dbd68279f177a1b8b3e29 (patch)
treefacf99da63cd2ffd0ece9ddbac545d84dd2945a8 /src/libserver/cfg_rcl.c
parent9e7c70034a91b90f09dd507b43214f84c05532ca (diff)
downloadrspamd-3262b2b175bb5de9eb3dbd68279f177a1b8b3e29.tar.gz
rspamd-3262b2b175bb5de9eb3dbd68279f177a1b8b3e29.zip
[Feature] Implement composites policies
Diffstat (limited to 'src/libserver/cfg_rcl.c')
-rw-r--r--src/libserver/cfg_rcl.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index a099ccda3..2869adacc 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -1430,7 +1430,7 @@ rspamd_rcl_composite_handler (rspamd_mempool_t *pool,
}
composite =
- rspamd_mempool_alloc (cfg->cfg_pool, sizeof (struct rspamd_composite));
+ rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (struct rspamd_composite));
composite->expr = expr;
composite->id = g_hash_table_size (cfg->composite_symbols);
g_hash_table_insert (cfg->composite_symbols,
@@ -1474,6 +1474,21 @@ rspamd_rcl_composite_handler (rspamd_mempool_t *pool,
description, group, FALSE, FALSE);
}
+ val = ucl_object_lookup (obj, "policy");
+
+ if (val) {
+ composite->policy = rspamd_composite_policy_from_str (
+ ucl_object_tostring (val));
+
+ if (composite->policy == RSPAMD_COMPOSITE_POLICY_UNKNOWN) {
+ g_set_error (err,
+ CFG_RCL_ERROR,
+ EINVAL,
+ "composite %s has incorrect policy", composite_name);
+ return FALSE;
+ }
+ }
+
return TRUE;
}