aboutsummaryrefslogtreecommitdiffstats
path: root/src/cfg_rcl.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-01 14:40:37 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-01 14:40:37 +0100
commitce054a80baae86f7abfa4f9bcabc909c6ec6ceb4 (patch)
tree5d962981fbd12a3958a5d157662453d95dfc10e7 /src/cfg_rcl.c
parent50bae963e44e0312544b79a2ee4b4a3e8e37690f (diff)
downloadrspamd-ce054a80baae86f7abfa4f9bcabc909c6ec6ceb4.tar.gz
rspamd-ce054a80baae86f7abfa4f9bcabc909c6ec6ceb4.zip
Add parser for default values in rcl section.
Diffstat (limited to 'src/cfg_rcl.c')
-rw-r--r--src/cfg_rcl.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/cfg_rcl.c b/src/cfg_rcl.c
index b08e530ab..89d0e54f6 100644
--- a/src/cfg_rcl.c
+++ b/src/cfg_rcl.c
@@ -293,6 +293,31 @@ rspamd_read_rcl_config (struct rspamd_rcl_section *top,
return TRUE;
}
+gboolean rspamd_rcl_section_parse_defaults (struct rspamd_rcl_section *section,
+ struct config_file *cfg, rspamd_cl_object_t *obj, gpointer ptr,
+ GError **err)
+{
+ rspamd_cl_object_t *found;
+ struct rspamd_rcl_default_handler_data *cur, *tmp;
+
+ if (obj->type != RSPAMD_CL_OBJECT) {
+ g_set_error (err, CFG_RCL_ERROR, EINVAL, "default configuration must be an object");
+ return FALSE;
+ }
+
+ HASH_ITER (hh, section->default_parser, cur, tmp) {
+ HASH_FIND_STR (obj->value.ov, cur->key, found);
+ if (found != NULL) {
+ cur->pd.user_struct = ptr;
+ if (!cur->handler (cfg, found, &cur->pd, section, err)) {
+ return FALSE;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
gboolean
rspamd_rcl_parse_struct_string (struct config_file *cfg, rspamd_cl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)