diff options
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/logger.c | 2 | ||||
-rw-r--r-- | src/libutil/radix.c | 10 | ||||
-rw-r--r-- | src/libutil/radix.h | 7 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/libutil/logger.c b/src/libutil/logger.c index 5db081b61..f25c1fe75 100644 --- a/src/libutil/logger.c +++ b/src/libutil/logger.c @@ -342,7 +342,7 @@ rspamd_set_logger (struct rspamd_config *cfg, "IP addresses for which debug logs are enabled", read_radix_list, fin_radix_list, (void **)&rspamd->logger->debug_ip)) { - rspamd_config_parse_ip_list (rspamd->cfg->debug_ip_map, + radix_add_generic_iplist (rspamd->cfg->debug_ip_map, &rspamd->logger->debug_ip); } } diff --git a/src/libutil/radix.c b/src/libutil/radix.c index c8aaaf946..c58125003 100644 --- a/src/libutil/radix.c +++ b/src/libutil/radix.c @@ -962,6 +962,16 @@ rspamd_radix_add_iplist (const gchar *list, const gchar *separators, return res; } +gboolean +radix_add_generic_iplist (const gchar *ip_list, radix_compressed_t **tree) +{ + if (*tree == NULL) { + *tree = radix_create_compressed (); + } + + return (rspamd_radix_add_iplist (ip_list, ",; ", *tree) > 0); +} + /* * vi:ts=4 */ diff --git a/src/libutil/radix.h b/src/libutil/radix.h index abe2a2899..b17731fd7 100644 --- a/src/libutil/radix.h +++ b/src/libutil/radix.h @@ -130,4 +130,11 @@ radix_compressed_t *radix_create_compressed (void); gint rspamd_radix_add_iplist (const gchar *list, const gchar *separators, radix_compressed_t *tree); +/** + * Generic version of @see rspamd_radix_add_iplist. This function creates tree + * if `tree` is NULL. + */ +gboolean radix_add_generic_iplist (const gchar *ip_list, + radix_compressed_t **tree); + #endif |