aboutsummaryrefslogtreecommitdiffstats
path: root/src/controller.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-30 12:01:33 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-30 12:01:33 +0100
commitfc417421d480731516f8e2086d80337871b9c500 (patch)
treeb56cebe7298b33ee83510ac83e02fc0c511edc0c /src/controller.c
parent10ba1f84ff47aa8b47a453c4b534bad638cd8dba (diff)
downloadrspamd-fc417421d480731516f8e2086d80337871b9c500.tar.gz
rspamd-fc417421d480731516f8e2086d80337871b9c500.zip
[Fix] Fix secure_ip setting in controller
Diffstat (limited to 'src/controller.c')
-rw-r--r--src/controller.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/controller.c b/src/controller.c
index 61a84ca7e..9bb6b3a3a 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -25,6 +25,7 @@
#include "ottery.h"
#include "libutil/rrd.h"
#include "unix-std.h"
+#include "utlist.h"
#include <math.h>
/* 60 seconds for worker's IO */
@@ -2564,9 +2565,10 @@ start_controller_worker (struct rspamd_worker *worker)
ctx->srv = worker->srv;
ctx->custom_commands = g_hash_table_new (rspamd_strcase_hash,
rspamd_strcase_equal);
- if (ctx->secure_ip != NULL) {
+ 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 &&
@@ -2586,10 +2588,22 @@ start_controller_worker (struct rspamd_worker *worker)
}
}
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);
+ 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);
+ }
+ }
}
}