aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-30 16:12:22 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-30 16:12:22 +0100
commit70fbd319e055e8eeecdd7a67aa832ac81476f4f3 (patch)
tree06264255711f15cd3a193c7758444208a9d698ab
parent1f9b24b312c6b7b6624c9efbdc59a282da82d24f (diff)
downloadrspamd-70fbd319e055e8eeecdd7a67aa832ac81476f4f3.tar.gz
rspamd-70fbd319e055e8eeecdd7a67aa832ac81476f4f3.zip
Parse bind_line in rcl.
-rw-r--r--src/cfg_rcl.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/cfg_rcl.c b/src/cfg_rcl.c
index 65c2e337d..70f51f8cd 100644
--- a/src/cfg_rcl.c
+++ b/src/cfg_rcl.c
@@ -370,10 +370,11 @@ static gboolean
rspamd_rcl_worker_handler (struct config_file *cfg, rspamd_cl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
- rspamd_cl_object_t *val;
- const gchar *worker_type;
+ rspamd_cl_object_t *val, *cur;
+ const gchar *worker_type, *worker_bind;
GQuark qtype;
struct worker_conf *wrk;
+ struct rspamd_worker_bind_conf *bcf;
val = rspamd_cl_obj_get_key (obj, "type");
if (val != NULL && rspamd_cl_obj_tostring_safe (val, &worker_type)) {
@@ -400,6 +401,27 @@ rspamd_rcl_worker_handler (struct config_file *cfg, rspamd_cl_object_t *obj,
return FALSE;
}
+ val = rspamd_cl_obj_get_key (obj, "bind_socket");
+ if (val != NULL) {
+ if (val->type == RSPAMD_CL_ARRAY) {
+ val = val->value.ov;
+ }
+ LL_FOREACH (val, cur) {
+ if (!rspamd_cl_obj_tostring_safe (cur, &worker_bind)) {
+ continue;
+ }
+ bcf = memory_pool_alloc0 (cfg->cfg_pool, sizeof (struct rspamd_worker_bind_conf));
+ if (!parse_host_port_priority (cfg->cfg_pool, worker_bind, &bcf->bind_host,
+ &bcf->bind_port, NULL)) {
+ g_set_error (err, CFG_RCL_ERROR, EINVAL, "cannot parse bind line: %s", worker_bind);
+ return FALSE;
+ }
+ LL_PREPEND (wrk->bind_conf, bcf);
+ }
+ }
+
+ wrk->options = obj;
+
return rspamd_rcl_section_parse_defaults (section, cfg, obj, wrk, err);
}