From: Vsevolod Stakhov Date: Tue, 10 May 2016 14:15:55 +0000 (+0100) Subject: [Feature] Use new maps API for local addrs X-Git-Tag: 1.3.0~499 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d29c88981e5d2de82354eafe3bb7433dda5b99b7;p=thirdparty%2Frspamd.git [Feature] Use new maps API for local addrs --- diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h index 2620b3aeed..e14fbd90a9 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 b90c1116b4..b07819b78e 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 4fc3eb613e..4ce90ba065 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); }