]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Use new maps API for local addrs
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 10 May 2016 14:15:55 +0000 (15:15 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 10 May 2016 14:15:55 +0000 (15:15 +0100)
src/libserver/cfg_file.h
src/libserver/cfg_rcl.c
src/libutil/util.c

index 2620b3aeed32d253db0f962ff5f4c9744ebcf4af..e14fbd90a90af0f3cb30cb82c1ba691fbf339ecf 100644 (file)
@@ -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
index b90c1116b4e754a29aca2e0b103b3dc768dd94dd..b07819b78ed5010ef4981ef393ba1b8bcc788318 100644 (file)
@@ -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");
index 4fc3eb613eda435eb60e4df66e6c78163460f90e..4ce90ba065cc5f2b662b4c66bccc2e501597b49f 100644 (file)
@@ -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);
                        }