diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-15 17:28:06 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-15 17:28:06 +0000 |
commit | 153e64677902c1acc7a1e8ee21d5b634d8a65885 (patch) | |
tree | f6055a7c820e067218142be908165a7746d192f3 /src/plugins | |
parent | df75947ab9f8bdd9eb2b5c05384d49e247c8b41d (diff) | |
download | rspamd-153e64677902c1acc7a1e8ee21d5b634d8a65885.tar.gz rspamd-153e64677902c1acc7a1e8ee21d5b634d8a65885.zip |
Fix logging for embedded maps
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/dkim_check.c | 16 | ||||
-rw-r--r-- | src/plugins/fuzzy_check.c | 17 | ||||
-rw-r--r-- | src/plugins/spf.c | 18 | ||||
-rw-r--r-- | src/plugins/surbl.c | 2 |
4 files changed, 38 insertions, 15 deletions
diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c index a30a52e6e..8147eb270 100644 --- a/src/plugins/dkim_check.c +++ b/src/plugins/dkim_check.c @@ -220,6 +220,7 @@ gint dkim_module_config (struct rspamd_config *cfg) { const ucl_object_t *value; + const gchar *str; gint res = TRUE, cb_id; guint cache_size, cache_expire; gboolean got_trusted = FALSE; @@ -277,11 +278,16 @@ dkim_module_config (struct rspamd_config *cfg) } if ((value = rspamd_config_get_module_opt (cfg, "dkim", "whitelist")) != NULL) { - if (!rspamd_map_add (cfg, ucl_obj_tostring (value), - "DKIM whitelist", rspamd_radix_read, rspamd_radix_fin, - (void **)&dkim_module_ctx->whitelist_ip)) { - radix_add_generic_iplist (ucl_obj_tostring (value), - &dkim_module_ctx->whitelist_ip); + str = ucl_obj_tostring (value); + if (!rspamd_map_is_map (str)) { + radix_add_generic_iplist (str, + &dkim_module_ctx->whitelist_ip); + } + else { + rspamd_map_add (cfg, str, + "DKIM whitelist", rspamd_radix_read, rspamd_radix_fin, + (void **)&dkim_module_ctx->whitelist_ip); + } } if ((value = diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 85c147a52..788601f1e 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -757,6 +757,7 @@ fuzzy_check_module_config (struct rspamd_config *cfg) { const ucl_object_t *value, *cur; gint res = TRUE, cb_id, nrules = 0; + const gchar *str; if (!rspamd_config_is_module_enabled (cfg, "fuzzy_check")) { return TRUE; @@ -824,12 +825,20 @@ fuzzy_check_module_config (struct rspamd_config *cfg) rspamd_config_get_module_opt (cfg, "fuzzy_check", "whitelist")) != NULL) { fuzzy_module_ctx->whitelist = radix_create_compressed (); - if (!rspamd_map_add (cfg, ucl_obj_tostring (value), - "Fuzzy whitelist", rspamd_radix_read, rspamd_radix_fin, - (void **)&fuzzy_module_ctx->whitelist)) { - radix_add_generic_iplist (ucl_obj_tostring (value), + ucl_obj_tostring (value); + + str = ucl_obj_tostring (value); + + if (!rspamd_map_is_map (str)) { + radix_add_generic_iplist (str, &fuzzy_module_ctx->whitelist); } + else { + rspamd_map_add (cfg, str, + "Fuzzy whitelist", rspamd_radix_read, rspamd_radix_fin, + (void **)&fuzzy_module_ctx->whitelist); + + } } else { fuzzy_module_ctx->whitelist = NULL; diff --git a/src/plugins/spf.c b/src/plugins/spf.c index a02dcc002..edad4bfc9 100644 --- a/src/plugins/spf.c +++ b/src/plugins/spf.c @@ -173,6 +173,7 @@ spf_module_config (struct rspamd_config *cfg) const ucl_object_t *value; gint res = TRUE, cb_id; guint cache_size, cache_expire; + const gchar *str; if (!rspamd_config_is_module_enabled (cfg, "spf")) { return TRUE; @@ -225,11 +226,18 @@ spf_module_config (struct rspamd_config *cfg) } if ((value = rspamd_config_get_module_opt (cfg, "spf", "whitelist")) != NULL) { - if (!rspamd_map_add (cfg, ucl_obj_tostring (value), - "SPF whitelist", rspamd_radix_read, rspamd_radix_fin, - (void **)&spf_module_ctx->whitelist_ip)) { - radix_add_generic_iplist (ucl_obj_tostring (value), - &spf_module_ctx->whitelist_ip); + + str = ucl_obj_tostring (value); + + if (!rspamd_map_is_map (str)) { + radix_add_generic_iplist (str, + &spf_module_ctx->whitelist_ip); + } + else { + rspamd_map_add (cfg, str, + "SPF whitelist", rspamd_radix_read, rspamd_radix_fin, + (void **)&spf_module_ctx->whitelist_ip); + } } diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index cbd5f0f2b..b49ed8f3c 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -574,7 +574,7 @@ surbl_module_config (struct rspamd_config *cfg) } } if ((value = - rspamd_config_get_module_opt (cfg, "surbl", "whitelist")) != NULL) { + rspamd_config_get_module_opt (cfg, "surbl", "whitelist")) != NULL) { if (rspamd_map_add (cfg, ucl_obj_tostring (value), "SURBL whitelist", rspamd_hosts_read, rspamd_hosts_fin, (void **)&surbl_module_ctx->whitelist)) { |