aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2016-12-21 12:37:16 +0200
committerAndrew Lewis <nerf@judo.za.org>2016-12-21 15:26:51 +0200
commitcb7c54ccf0faa730b2da1f6a4dcac30b2d9e7d6d (patch)
tree3d9af63b3ece12f01fb033b0d1fac467f4d15219 /src
parentf41e30b785e5d35bf11c71ed3346095eacb797b4 (diff)
downloadrspamd-cb7c54ccf0faa730b2da1f6a4dcac30b2d9e7d6d.tar.gz
rspamd-cb7c54ccf0faa730b2da1f6a4dcac30b2d9e7d6d.zip
[Rework] Composite configuration (#1270)
Diffstat (limited to 'src')
-rw-r--r--src/libserver/cfg_rcl.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index b8423bb5d..6f9e66d5c 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -1505,6 +1505,29 @@ rspamd_rcl_composite_handler (rspamd_mempool_t *pool,
return TRUE;
}
+static gboolean
+rspamd_rcl_composites_handler (rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ const gchar *key,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err)
+{
+ ucl_object_iter_t it = NULL;
+ const ucl_object_t *cur;
+ gboolean success = TRUE;
+
+ while ((cur = ucl_iterate_object (obj, &it, true))) {
+ success = rspamd_rcl_composite_handler(pool, cur, ucl_object_key(cur), ud, section, err);
+ if (!success) {
+ break;
+ }
+ }
+
+ return success;
+}
+
+
struct rspamd_rcl_section *
rspamd_rcl_add_section (struct rspamd_rcl_section **top,
const gchar *name, const gchar *key_attr, rspamd_rcl_handler_t handler,
@@ -2317,7 +2340,7 @@ rspamd_rcl_config_init (struct rspamd_config *cfg)
"Sets if this statfile contains spam samples");
/**
- * Composites handler
+ * Composites handlers
*/
sub = rspamd_rcl_add_section_doc (&new,
"composite", "name",
@@ -2327,6 +2350,14 @@ rspamd_rcl_config_init (struct rspamd_config *cfg)
TRUE,
cfg->doc_strings,
"Rspamd composite symbols");
+ sub = rspamd_rcl_add_section_doc (&new,
+ "composites", NULL,
+ rspamd_rcl_composites_handler,
+ UCL_OBJECT,
+ FALSE,
+ TRUE,
+ cfg->doc_strings,
+ "Rspamd composite symbols");
/**
* Lua handler