From 61f5955c49d8846fec3e4deaa9d49c7ac3823888 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 15 Mar 2016 14:55:51 +0000 Subject: [PATCH] [Feature] Allow raw ucl options in the config --- src/libserver/cfg_rcl.c | 18 ++++++++++++++++++ src/libserver/cfg_rcl.h | 15 +++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index 265b14ca4..e33bff155 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -2725,6 +2725,24 @@ rspamd_rcl_parse_struct_string_list (rspamd_mempool_t *pool, return TRUE; } +gboolean +rspamd_rcl_parse_struct_ucl (rspamd_mempool_t *pool, + const ucl_object_t *obj, + gpointer ud, + struct rspamd_rcl_section *section, + GError **err) +{ + struct rspamd_rcl_struct_parser *pd = ud; + const ucl_object_t **target; + + target = (const ucl_object_t **)(((gchar *)pd->user_struct) + pd->offset); + + *target = obj; + + return TRUE; +} + + gboolean rspamd_rcl_parse_struct_boolean (rspamd_mempool_t *pool, const ucl_object_t *obj, diff --git a/src/libserver/cfg_rcl.h b/src/libserver/cfg_rcl.h index e91779b87..ee0a1b526 100644 --- a/src/libserver/cfg_rcl.h +++ b/src/libserver/cfg_rcl.h @@ -307,6 +307,21 @@ gboolean rspamd_rcl_parse_struct_mime_addr (rspamd_mempool_t *pool, struct rspamd_rcl_section *section, GError **err); +/** + * Parse a raw ucl object + * @param cfg config pointer + * @param obj object to parse + * @param ud struct_parser structure (flags mean the exact structure used) + * @param section the current section + * @param err error pointer + * @return TRUE if a value has been successfully parsed + */ +gboolean rspamd_rcl_parse_struct_ucl (rspamd_mempool_t *pool, + const ucl_object_t *obj, + gpointer ud, + struct rspamd_rcl_section *section, + GError **err); + /** * Utility functions */ -- 2.39.5