From: Vsevolod Stakhov Date: Mon, 30 Sep 2013 15:12:22 +0000 (+0100) Subject: Parse bind_line in rcl. X-Git-Tag: 0.6.0~157 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70fbd319e055e8eeecdd7a67aa832ac81476f4f3;p=thirdparty%2Frspamd.git Parse bind_line in rcl. --- diff --git a/src/cfg_rcl.c b/src/cfg_rcl.c index 65c2e337dd..70f51f8cdb 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); }