]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow raw ucl options in the config
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 15 Mar 2016 14:55:51 +0000 (14:55 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 15 Mar 2016 14:55:51 +0000 (14:55 +0000)
src/libserver/cfg_rcl.c
src/libserver/cfg_rcl.h

index 265b14ca4e61d0366516761243c380e40424cd45..e33bff15552ed58ec2d70db76a221678f2945294 100644 (file)
@@ -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,
index e91779b87ded0ef117c4456852c80621bbdc8952..ee0a1b5260dd35017523fcc5933cb8102a2ff058 100644 (file)
@@ -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
  */