gpointer def_ud;
};
-static gboolean rspamd_rcl_process_section (struct rspamd_rcl_section *sec,
+static gboolean rspamd_rcl_process_section (struct rspamd_config *cfg,
+ struct rspamd_rcl_section *sec,
gpointer ptr, const ucl_object_t *obj, rspamd_mempool_t *pool,
GError **err);
}
}
- return rspamd_rcl_section_parse_defaults (section, cfg->cfg_pool, obj,
+ return rspamd_rcl_section_parse_defaults (cfg, section, cfg->cfg_pool, obj,
cfg, err);
}
dns = ucl_object_lookup (obj, "dns");
if (dns_section != NULL && dns != NULL) {
- if (!rspamd_rcl_section_parse_defaults (dns_section, cfg->cfg_pool, dns,
+ if (!rspamd_rcl_section_parse_defaults (cfg,
+ dns_section, cfg->cfg_pool, dns,
cfg, err)) {
return FALSE;
}
upstream = ucl_object_lookup (obj, "upstream");
if (upstream_section != NULL && upstream != NULL) {
- if (!rspamd_rcl_section_parse_defaults (upstream_section, cfg->cfg_pool,
- upstream, cfg, err)) {
+ if (!rspamd_rcl_section_parse_defaults (cfg,
+ upstream_section, cfg->cfg_pool,
+ upstream, cfg, err)) {
return FALSE;
}
}
- if (rspamd_rcl_section_parse_defaults (section, cfg->cfg_pool, obj,
+ if (rspamd_rcl_section_parse_defaults (cfg,
+ section, cfg->cfg_pool, obj,
cfg, err)) {
/* We need to init this early */
rspamd_multipattern_library_init (cfg->hs_cache_dir);
gr = rspamd_config_new_group (sd->cfg, metric, key);
}
- if (!rspamd_rcl_section_parse_defaults (section, pool, obj,
+ if (!rspamd_rcl_section_parse_defaults (sd->cfg, section, pool, obj,
gr, err)) {
return FALSE;
}
g_assert (subsection != NULL);
LL_FOREACH (val, cur) {
- if (!rspamd_rcl_process_section (subsection, sd, cur,
+ if (!rspamd_rcl_process_section (sd->cfg, subsection, sd, cur,
pool, err)) {
return FALSE;
}
metric = rspamd_config_new_metric (cfg, metric, key);
}
- if (!rspamd_rcl_section_parse_defaults (section, cfg->cfg_pool, obj,
+ if (!rspamd_rcl_section_parse_defaults (cfg, section, cfg->cfg_pool, obj,
metric, err)) {
return FALSE;
}
acts_cbdata.cfg = cfg;
acts_cbdata.metric = metric;
- if (!rspamd_rcl_process_section (subsection, &acts_cbdata, val,
+ if (!rspamd_rcl_process_section (cfg, subsection, &acts_cbdata, val,
cfg->cfg_pool, err)) {
return FALSE;
}
sd.metric = metric;
LL_FOREACH (val, cur) {
- if (!rspamd_rcl_process_section (subsection, &sd, cur,
+ if (!rspamd_rcl_process_section (cfg, subsection, &sd, cur,
cfg->cfg_pool, err)) {
return FALSE;
}
sd.metric = metric;
LL_FOREACH (val, cur) {
- if (!rspamd_rcl_process_section (subsection, &sd, cur,
+ if (!rspamd_rcl_process_section (cfg, subsection, &sd, cur,
cfg->cfg_pool, err)) {
return FALSE;
}
wrk->options = (ucl_object_t *)obj;
- if (!rspamd_rcl_section_parse_defaults (section, cfg->cfg_pool, obj,
+ if (!rspamd_rcl_section_parse_defaults (cfg, section, cfg->cfg_pool, obj,
wrk, err)) {
return FALSE;
}
st = rspamd_config_new_statfile (cfg, NULL);
st->symbol = rspamd_mempool_strdup (cfg->cfg_pool, key);
- if (rspamd_rcl_section_parse_defaults (section, pool, obj, st, err)) {
+ if (rspamd_rcl_section_parse_defaults (cfg, section, pool, obj, st, err)) {
ccf->statfiles = g_list_prepend (ccf->statfiles, st);
if (st->label != NULL) {
labels = g_hash_table_lookup (ccf->labels, st->label);
ccf->classifier = rspamd_mempool_strdup (cfg->cfg_pool, key);
- if (rspamd_rcl_section_parse_defaults (section, cfg->cfg_pool, obj,
+ if (rspamd_rcl_section_parse_defaults (cfg, section, cfg->cfg_pool, obj,
ccf, err)) {
HASH_FIND_STR (section->subsections, "statfile", stat_section);
LL_FOREACH (val, cur) {
stud.cfg = cfg;
stud.ccf = ccf;
- res = rspamd_rcl_process_section (stat_section, &stud,
+ res = rspamd_rcl_process_section (cfg, stat_section, &stud,
cur, cfg->cfg_pool, err);
if (!res) {
}
static gboolean
-rspamd_rcl_process_section (struct rspamd_rcl_section *sec,
+rspamd_rcl_process_section (struct rspamd_config *cfg,
+ struct rspamd_rcl_section *sec,
gpointer ptr, const ucl_object_t *obj, rspamd_mempool_t *pool,
GError **err)
{
gboolean
rspamd_rcl_parse (struct rspamd_rcl_section *top,
+ struct rspamd_config *cfg,
gpointer ptr, rspamd_mempool_t *pool,
const ucl_object_t *obj, GError **err)
{
if (found_sec == NULL) {
if (cur->handler != NULL) {
- if (!rspamd_rcl_process_section (cur, ptr, cur_obj,
+ if (!rspamd_rcl_process_section (cfg, cur, ptr, cur_obj,
pool, err)) {
return FALSE;
}
}
else {
- rspamd_rcl_section_parse_defaults (cur,
+ rspamd_rcl_section_parse_defaults (cfg,
+ cur,
pool,
cur_obj,
ptr,
LL_FOREACH (found, cur_obj) {
if (cur->handler != NULL) {
- if (!rspamd_rcl_process_section (cur, ptr, cur_obj,
+ if (!rspamd_rcl_process_section (cfg, cur, ptr, cur_obj,
pool, err)) {
return FALSE;
}
}
else {
- rspamd_rcl_section_parse_defaults (cur,
+ rspamd_rcl_section_parse_defaults (cfg, cur,
pool,
cur_obj,
ptr,
}
gboolean
-rspamd_rcl_section_parse_defaults (struct rspamd_rcl_section *section,
- rspamd_mempool_t *pool, const ucl_object_t *obj, gpointer ptr,
- GError **err)
+rspamd_rcl_section_parse_defaults (struct rspamd_config *cfg,
+ struct rspamd_rcl_section *section,
+ rspamd_mempool_t *pool, const ucl_object_t *obj, gpointer ptr,
+ GError **err)
{
const ucl_object_t *found, *cur_obj;
struct rspamd_rcl_default_handler_data *cur, *tmp;
found = ucl_object_lookup (obj, cur->key);
if (found != NULL) {
cur->pd.user_struct = ptr;
+ cur->pd.cfg = cfg;
LL_FOREACH (found, cur_obj) {
if (!cur->handler (pool, cur_obj, &cur->pd, section, err)) {
}
}
- if (!rspamd_rcl_parse (top, cfg, cfg->cfg_pool, cfg->rcl_obj, &err)) {
+ if (!rspamd_rcl_parse (top, cfg, cfg, cfg->cfg_pool, cfg->rcl_obj, &err)) {
msg_err_config ("rcl parse error: %e", err);
g_error_free (err);
return FALSE;