]> source.dussan.org Git - rspamd.git/commitdiff
Parse all objects from ucl.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 26 Oct 2013 14:37:36 +0000 (15:37 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 26 Oct 2013 14:37:36 +0000 (15:37 +0100)
src/cfg_rcl.c
src/filter.h

index 34999f66a06223a184b04f0bf5b9e4f65d0a1512..a993a4aceaa901cec90665419221dbc4bcab2937 100644 (file)
@@ -420,7 +420,7 @@ rspamd_rcl_metric_handler (struct config_file *cfg, ucl_object_t *obj,
        }
 
        /* Insert the resulting metric */
-       g_hash_table_insert (cfg->metrics, metric->name, metric);
+       g_hash_table_insert (cfg->metrics, (void *)metric->name, metric);
        cfg->metrics_list = g_list_prepend (cfg->metrics_list, metric);
 
        return TRUE;
@@ -694,7 +694,7 @@ gboolean
 rspamd_read_rcl_config (struct rspamd_rcl_section *top,
                struct config_file *cfg, ucl_object_t *obj, GError **err)
 {
-       ucl_object_t *found;
+       ucl_object_t *found, *cur_obj;
        struct rspamd_rcl_section *cur, *tmp;
 
        if (obj->type != UCL_OBJECT) {
@@ -719,8 +719,10 @@ rspamd_read_rcl_config (struct rspamd_rcl_section *top,
                                        return FALSE;
                                }
                        }
-                       if (!cur->handler (cfg, found, NULL, cur, err)) {
-                               return FALSE;
+                       LL_FOREACH (found, cur_obj) {
+                               if (!cur->handler (cfg, cur_obj, NULL, cur, err)) {
+                                       return FALSE;
+                               }
                        }
                }
        }
index 7843775acc6fec5bbba4c347223b10072e7a57d6..79fae64495005e737adb1c3bafd1419603fe3e4a 100644 (file)
@@ -55,7 +55,7 @@ struct metric_action {
  * Common definition of metric
  */
 struct metric {
-       gchar *name;                                                                    /**< name of metric                                                                     */
+       const gchar *name;                                                              /**< name of metric                                                                     */
        gchar *func_name;                                                               /**< name of consolidation function                                     */
        metric_cons_func func;                                                  /**< c consolidation function                                           */
        double grow_factor;                                                             /**< grow factor for metric                                                     */