aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-10 15:29:05 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-10 15:29:05 +0100
commit62cc91ffb8af40cca3dc82037d87bab8ff270524 (patch)
tree1878eee77b51c88d041fcdad7cea7365cf8f1d6c /src/plugins
parentd29c88981e5d2de82354eafe3bb7433dda5b99b7 (diff)
downloadrspamd-62cc91ffb8af40cca3dc82037d87bab8ff270524.tar.gz
rspamd-62cc91ffb8af40cca3dc82037d87bab8ff270524.zip
[Feature] Adopt plugins for new maps API
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dkim_check.c9
-rw-r--r--src/plugins/fuzzy_check.c4
-rw-r--r--src/plugins/spf.c4
-rw-r--r--src/plugins/surbl.c6
4 files changed, 12 insertions, 11 deletions
diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c
index 9cf89674e..3ea31485f 100644
--- a/src/plugins/dkim_check.c
+++ b/src/plugins/dkim_check.c
@@ -271,13 +271,14 @@ dkim_module_config (struct rspamd_config *cfg)
}
if ((value =
rspamd_config_get_module_opt (cfg, "dkim", "whitelist")) != NULL) {
+
str = ucl_obj_tostring (value);
- if (!rspamd_map_is_map (str)) {
+ if (str && !rspamd_map_is_map (str)) {
radix_add_generic_iplist (str,
&dkim_module_ctx->whitelist_ip);
}
else {
- rspamd_map_add (cfg, str,
+ rspamd_map_add_from_ucl (cfg, value,
"DKIM whitelist", rspamd_radix_read, rspamd_radix_fin,
(void **)&dkim_module_ctx->whitelist_ip);
@@ -285,7 +286,7 @@ dkim_module_config (struct rspamd_config *cfg)
}
if ((value =
rspamd_config_get_module_opt (cfg, "dkim", "domains")) != NULL) {
- if (!rspamd_map_add (cfg, ucl_obj_tostring (value),
+ if (!rspamd_map_add_from_ucl (cfg, value,
"DKIM domains", rspamd_kv_list_read, rspamd_kv_list_fin,
(void **)&dkim_module_ctx->dkim_domains)) {
msg_warn_config ("cannot load dkim domains list from %s",
@@ -297,7 +298,7 @@ dkim_module_config (struct rspamd_config *cfg)
}
if (!got_trusted && (value =
rspamd_config_get_module_opt (cfg, "dkim", "trusted_domains")) != NULL) {
- if (!rspamd_map_add (cfg, ucl_obj_tostring (value),
+ if (!rspamd_map_add_from_ucl (cfg, value,
"DKIM domains", rspamd_kv_list_read, rspamd_kv_list_fin,
(void **)&dkim_module_ctx->dkim_domains)) {
msg_warn_config ("cannot load dkim domains list from %s",
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c
index 385b8aadc..a5b62875e 100644
--- a/src/plugins/fuzzy_check.c
+++ b/src/plugins/fuzzy_check.c
@@ -832,12 +832,12 @@ fuzzy_check_module_config (struct rspamd_config *cfg)
str = ucl_obj_tostring (value);
- if (!rspamd_map_is_map (str)) {
+ if (str && !rspamd_map_is_map (str)) {
radix_add_generic_iplist (str,
&fuzzy_module_ctx->whitelist);
}
else {
- rspamd_map_add (cfg, str,
+ rspamd_map_add_from_ucl (cfg, value,
"Fuzzy whitelist", rspamd_radix_read, rspamd_radix_fin,
(void **)&fuzzy_module_ctx->whitelist);
diff --git a/src/plugins/spf.c b/src/plugins/spf.c
index 153422f51..67c8732e7 100644
--- a/src/plugins/spf.c
+++ b/src/plugins/spf.c
@@ -213,12 +213,12 @@ spf_module_config (struct rspamd_config *cfg)
str = ucl_obj_tostring (value);
- if (!rspamd_map_is_map (str)) {
+ if (str && !rspamd_map_is_map (str)) {
radix_add_generic_iplist (str,
&spf_module_ctx->whitelist_ip);
}
else {
- rspamd_map_add (cfg, str,
+ rspamd_map_add_from_ucl (cfg, value,
"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 35383c829..87b8effa7 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -528,7 +528,7 @@ surbl_module_config (struct rspamd_config *cfg)
if ((value =
rspamd_config_get_module_opt (cfg, "surbl",
"redirector_hosts_map")) != NULL) {
- if (!rspamd_map_add (cfg, ucl_obj_tostring (value),
+ if (!rspamd_map_add_from_ucl (cfg, value,
"SURBL redirectors list", read_redirectors_list, fin_redirectors_list,
(void **)&surbl_module_ctx->redirector_map_data)) {
@@ -546,7 +546,7 @@ surbl_module_config (struct rspamd_config *cfg)
}
if ((value =
rspamd_config_get_module_opt (cfg, "surbl", "exceptions")) != NULL) {
- if (rspamd_map_add (cfg, ucl_obj_tostring (value),
+ if (rspamd_map_add_from_ucl (cfg, value,
"SURBL exceptions list", read_exceptions_list, fin_exceptions_list,
(void **)&surbl_module_ctx->exceptions)) {
surbl_module_ctx->tld2_file = rspamd_mempool_strdup (
@@ -556,7 +556,7 @@ surbl_module_config (struct rspamd_config *cfg)
}
if ((value =
rspamd_config_get_module_opt (cfg, "surbl", "whitelist")) != NULL) {
- if (rspamd_map_add (cfg, ucl_obj_tostring (value),
+ if (rspamd_map_add_from_ucl (cfg, value,
"SURBL whitelist", rspamd_hosts_read, rspamd_hosts_fin,
(void **)&surbl_module_ctx->whitelist)) {
surbl_module_ctx->whitelist_file = rspamd_mempool_strdup (