aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-10 15:15:55 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-10 15:15:55 +0100
commitd29c88981e5d2de82354eafe3bb7433dda5b99b7 (patch)
tree80b629411c76ef0a8fdc1f74eee4884d2651cf00
parent4295cb4b80992958f61a63281ba65e3a8f0516d0 (diff)
downloadrspamd-d29c88981e5d2de82354eafe3bb7433dda5b99b7.tar.gz
rspamd-d29c88981e5d2de82354eafe3bb7433dda5b99b7.zip
[Feature] Use new maps API for local addrs
-rw-r--r--src/libserver/cfg_file.h2
-rw-r--r--src/libserver/cfg_rcl.c2
-rw-r--r--src/libutil/util.c7
3 files changed, 6 insertions, 5 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index 2620b3aee..e14fbd90a 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -277,7 +277,7 @@ struct rspamd_config {
gchar *pid_file; /**< name of pid file */
gchar *temp_dir; /**< dir for temp files */
gchar *control_socket_path; /**< path to the control socket */
- gchar *local_addrs; /**< tree of local addresses */
+ const ucl_object_t *local_addrs; /**< tree of local addresses */
#ifdef WITH_GPERF_TOOLS
gchar *profile_path;
#endif
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index b90c1116b..b07819b78 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -1894,7 +1894,7 @@ rspamd_rcl_config_init (struct rspamd_config *cfg)
"Limit of files count in `cores_dir`");
rspamd_rcl_add_default_handler (sub,
"local_addrs",
- rspamd_rcl_parse_struct_string,
+ rspamd_rcl_parse_struct_ucl,
G_STRUCT_OFFSET (struct rspamd_config, local_addrs),
0,
"Use the specified addresses as local ones");
diff --git a/src/libutil/util.c b/src/libutil/util.c
index 4fc3eb613..4ce90ba06 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -1981,12 +1981,13 @@ rspamd_config_libs (struct rspamd_external_libs_ctx *ctx,
if (ctx != NULL) {
if (cfg->local_addrs) {
- if (!rspamd_map_is_map (cfg->local_addrs)) {
- radix_add_generic_iplist (cfg->local_addrs,
+ if (ucl_object_type (cfg->local_addrs) == UCL_STRING &&
+ !rspamd_map_is_map (ucl_object_tostring (cfg->local_addrs))) {
+ radix_add_generic_iplist (ucl_object_tostring (cfg->local_addrs),
(radix_compressed_t **)ctx->local_addrs);
}
else {
- rspamd_map_add (cfg, cfg->local_addrs,
+ rspamd_map_add_from_ucl (cfg, cfg->local_addrs,
"Local addresses", rspamd_radix_read, rspamd_radix_fin,
(void **) ctx->local_addrs);
}