summaryrefslogtreecommitdiffstats
path: root/src/controller.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-25 13:40:00 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-25 13:40:00 +0100
commit9919068fcd7e999502ec62cc1fd2b794e5ced55b (patch)
tree4dc488bf5d33a94632e958753ed1da7f97b8b809 /src/controller.c
parentf0448d158b9858294a5cd54d3b2fab15193f1485 (diff)
downloadrspamd-9919068fcd7e999502ec62cc1fd2b794e5ced55b.tar.gz
rspamd-9919068fcd7e999502ec62cc1fd2b794e5ced55b.zip
[Feature] Use new ip parsing API
Diffstat (limited to 'src/controller.c')
-rw-r--r--src/controller.c43
1 files changed, 3 insertions, 40 deletions
diff --git a/src/controller.c b/src/controller.c
index f2352e514..1021939ae 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -2565,8 +2565,6 @@ start_controller_worker (struct rspamd_worker *worker)
GHashTableIter iter;
gpointer key, value;
struct rspamd_keypair_cache *cache;
- const ucl_object_t *cur;
- ucl_object_iter_t it = NULL;
gpointer m;
ctx->ev_base = rspamd_prepare_worker (worker,
@@ -2582,44 +2580,9 @@ start_controller_worker (struct rspamd_worker *worker)
rspamd_strcase_equal);
if (ctx->secure_ip != NULL) {
- if (ucl_object_type (ctx->secure_ip) == UCL_ARRAY) {
-
- while ((cur = ucl_object_iterate (ctx->secure_ip, &it, true)) != NULL) {
- /* Try map syntax */
- if (ucl_object_type (cur) == UCL_STRING &&
- !rspamd_map_is_map (ucl_object_tostring (cur))) {
- if (!radix_add_generic_iplist (ucl_object_tostring (cur),
- &ctx->secure_map)) {
- msg_warn_ctx ("cannot load or parse ip list from '%s'",
- ucl_object_tostring (cur));
- }
- }
- else {
- rspamd_map_add_from_ucl (worker->srv->cfg, cur,
- "Allow webui access from the specified IP",
- rspamd_radix_read, rspamd_radix_fin,
- (void **)&ctx->secure_map);
- }
- }
- }
- else {
- LL_FOREACH (ctx->secure_ip, cur) {
- if (ucl_object_type (cur) == UCL_STRING &&
- !rspamd_map_is_map (ucl_object_tostring (cur))) {
- if (!radix_add_generic_iplist (ucl_object_tostring (cur),
- &ctx->secure_map)) {
- msg_warn_ctx ("cannot load or parse ip list from '%s'",
- ucl_object_tostring (cur));
- }
- }
- else {
- rspamd_map_add_from_ucl (worker->srv->cfg, ctx->secure_ip,
- "Allow webui access from the specified IP",
- rspamd_radix_read, rspamd_radix_fin,
- (void **)&ctx->secure_map);
- }
- }
- }
+ rspamd_config_radix_from_ucl (ctx->cfg, ctx->secure_ip,
+ "Allow unauthenticated requests from these addresses",
+ &ctx->secure_map, NULL);
}
if (ctx->saved_stats_path == NULL) {