aboutsummaryrefslogtreecommitdiffstats
path: root/src/cfg_rcl.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-29 14:24:36 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-29 14:24:36 +0000
commitea179f89ae66d2418109b43baf7506bcecc048e9 (patch)
treeca9fb20d2d92e5cd29adc6d7b848668d0403b25e /src/cfg_rcl.c
parentc6af76b620742ac7c9075c4d1226895aa49842f8 (diff)
downloadrspamd-ea179f89ae66d2418109b43baf7506bcecc048e9.tar.gz
rspamd-ea179f89ae66d2418109b43baf7506bcecc048e9.zip
Warn about composites redefinition.
Diffstat (limited to 'src/cfg_rcl.c')
-rw-r--r--src/cfg_rcl.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cfg_rcl.c b/src/cfg_rcl.c
index aedee7ea3..4eb270c3e 100644
--- a/src/cfg_rcl.c
+++ b/src/cfg_rcl.c
@@ -841,6 +841,7 @@ rspamd_rcl_composite_handler (struct config_file *cfg, ucl_object_t *obj,
struct expression *expr;
struct rspamd_composite *composite;
const gchar *composite_name, *composite_expression;
+ gboolean new = TRUE;
val = ucl_object_find_key (obj, "name");
if (val == NULL || !ucl_object_tostring_safe (val, &composite_name)) {
@@ -848,6 +849,11 @@ rspamd_rcl_composite_handler (struct config_file *cfg, ucl_object_t *obj,
return FALSE;
}
+ if (g_hash_table_lookup (cfg->composite_symbols, composite_name) != NULL) {
+ msg_warn ("composite %s is redefined", composite_name);
+ new = FALSE;
+ }
+
val = ucl_object_find_key (obj, "expression");
if (val == NULL || !ucl_object_tostring_safe (val, &composite_expression)) {
g_set_error (err, CFG_RCL_ERROR, EINVAL, "composite must have an expression defined");
@@ -863,7 +869,10 @@ rspamd_rcl_composite_handler (struct config_file *cfg, ucl_object_t *obj,
composite->expr = expr;
composite->id = g_hash_table_size (cfg->composite_symbols) + 1;
g_hash_table_insert (cfg->composite_symbols, (gpointer)composite_name, composite);
- register_virtual_symbol (&cfg->cache, composite_name, 1);
+
+ if (new) {
+ register_virtual_symbol (&cfg->cache, composite_name, 1);
+ }
return TRUE;
}