aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/cfg_rcl.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-05-15 14:21:41 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-05-15 14:21:41 +0100
commitf57c6e2c50e05aebbc9020fc9fe58b647b15b9dd (patch)
tree53f4d90ce06efaabf776586bdd8e038744b33a5f /src/libserver/cfg_rcl.c
parent1d2cb297a1cd882e6b0ea75ca5c081f844742c18 (diff)
downloadrspamd-f57c6e2c50e05aebbc9020fc9fe58b647b15b9dd.tar.gz
rspamd-f57c6e2c50e05aebbc9020fc9fe58b647b15b9dd.zip
[Feature] Allow multiple groups for symbols
Diffstat (limited to 'src/libserver/cfg_rcl.c')
-rw-r--r--src/libserver/cfg_rcl.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index 47e730af0..d4aa5314b 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -438,6 +438,22 @@ rspamd_rcl_symbol_handler (rspamd_mempool_t *pool, const ucl_object_t *obj,
description, NULL, flags, priority, nshots);
}
+ elt = ucl_object_lookup (obj, "groups");
+
+ if (elt) {
+ ucl_object_iter_t gr_it;
+ const ucl_object_t *cur_gr;
+
+ gr_it = ucl_object_iterate_new (elt);
+
+ while ((cur_gr = ucl_object_iterate_safe (gr_it, true)) != NULL) {
+ rspamd_config_add_symbol_group (cfg, key,
+ ucl_object_tostring (cur_gr));
+ }
+
+ ucl_object_iterate_free (gr_it);
+ }
+
return TRUE;
}
@@ -1423,7 +1439,7 @@ rspamd_rcl_composite_handler (rspamd_mempool_t *pool,
struct rspamd_rcl_section *section,
GError **err)
{
- const ucl_object_t *val;
+ const ucl_object_t *val, *elt;
struct rspamd_expression *expr;
struct rspamd_config *cfg = ud;
struct rspamd_composite *composite;
@@ -1500,6 +1516,22 @@ rspamd_rcl_composite_handler (rspamd_mempool_t *pool,
rspamd_config_add_symbol (cfg, composite_name, score,
description, group, FALSE, FALSE,
1);
+
+ elt = ucl_object_lookup (obj, "groups");
+
+ if (elt) {
+ ucl_object_iter_t gr_it;
+ const ucl_object_t *cur_gr;
+
+ gr_it = ucl_object_iterate_new (elt);
+
+ while ((cur_gr = ucl_object_iterate_safe (gr_it, true)) != NULL) {
+ rspamd_config_add_symbol_group (cfg, key,
+ ucl_object_tostring (cur_gr));
+ }
+
+ ucl_object_iterate_free (gr_it);
+ }
}
val = ucl_object_lookup (obj, "policy");