summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-11-30 00:21:04 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-11-30 00:21:04 +0000
commit7e08afed0e793c5d3f0db161a1f5a8931c1f3143 (patch)
tree98b361dfb89316ee54762c7293d9a08ddb71a21d
parent7838bab72371367baa909471ccb734426a6955d2 (diff)
downloadrspamd-7e08afed0e793c5d3f0db161a1f5a8931c1f3143.tar.gz
rspamd-7e08afed0e793c5d3f0db161a1f5a8931c1f3143.zip
Fix fuzzy check configuration.
-rw-r--r--conf/options.conf2
-rw-r--r--src/plugins/fuzzy_check.c11
2 files changed, 9 insertions, 4 deletions
diff --git a/conf/options.conf b/conf/options.conf
index b074c5556..841372ec2 100644
--- a/conf/options.conf
+++ b/conf/options.conf
@@ -2,7 +2,7 @@
options {
pidfile = "$RUNDIR/rspamd.pid";
- filters = "chartable,dkim,spf,surbl,regexp";
+ filters = "chartable,dkim,spf,surbl,regexp,fuzzy_check";
raw_mode = false;
one_shot = false;
dns_timeout = 1s;
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c
index de3fdb57b..71be7116e 100644
--- a/src/plugins/fuzzy_check.c
+++ b/src/plugins/fuzzy_check.c
@@ -190,15 +190,19 @@ parse_flags_string (struct config_file *cfg, ucl_object_t *val)
{
ucl_object_t *elt;
struct fuzzy_mapping *map;
+ const gchar *sym = NULL;
if (val->type == UCL_STRING) {
parse_flags_string_old (cfg, ucl_obj_tostring (val));
}
else if (val->type == UCL_OBJECT) {
elt = ucl_obj_get_key (val, "symbol");
- if (elt != NULL) {
+ if (elt == NULL || !ucl_object_tostring_safe (elt, &sym)) {
+ sym = ucl_object_key (val);
+ }
+ if (sym != NULL) {
map = memory_pool_alloc (fuzzy_module_ctx->fuzzy_pool, sizeof (struct fuzzy_mapping));
- map->symbol = ucl_obj_tostring (elt);
+ map->symbol = sym;
elt = ucl_obj_get_key (val, "flag");
if (elt != NULL && ucl_obj_toint_safe (elt, &map->fuzzy_flag)) {
elt = ucl_obj_get_key (val, "weight");
@@ -365,6 +369,7 @@ gint
fuzzy_check_module_config (struct config_file *cfg)
{
ucl_object_t *value, *cur;
+ ucl_object_iter_t it = NULL;
gint res = TRUE;
if ((value = get_module_opt (cfg, "fuzzy_check", "symbol")) != NULL) {
@@ -434,7 +439,7 @@ fuzzy_check_module_config (struct config_file *cfg)
}
}
if ((value = get_module_opt (cfg, "fuzzy_check", "fuzzy_map")) != NULL) {
- LL_FOREACH (value, cur) {
+ while ((cur = ucl_iterate_object (value, &it, true)) != NULL) {
parse_flags_string (cfg, cur);
}
}