]> source.dussan.org Git - rspamd.git/commitdiff
Fix options in statfiles.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 15 Nov 2013 14:55:40 +0000 (14:55 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 15 Nov 2013 14:55:40 +0000 (14:55 +0000)
src/cfg_file.h
src/cfg_rcl.c
src/cfg_utils.c
src/cfg_xml.c
src/lua/lua_classifier.c

index b4cc4ded14b2bee977289808800160f4eadd027f..f2744cb2c85d3954023f0b9b8a150e861403a7df 100644 (file)
@@ -217,7 +217,7 @@ struct statfile {
     statfile_normalize_func normalizer;             /**< function that is used as normaliser                */
     void *normalizer_data;                          /**< normalizer function params                         */
        gchar *normalizer_str;                                                  /**< source string (for dump)                                                   */
-       GHashTable *opts;                                                               /**< different statfile options                                                 */
+       ucl_object_t *opts;                                                             /**< other options                                                                              */
        gboolean is_spam;                                                               /**< spam flag                                                                                  */
 };
 
index 956c60bb87bd6834bcc26ab4b0e0427737d20604..be7bb2a4805a89657e3c6e590a6cb3b453c684c4 100644 (file)
@@ -772,6 +772,8 @@ rspamd_rcl_statfile_handler (struct config_file *cfg, ucl_object_t *obj,
                        return FALSE;
                }
 
+               st->opts = obj;
+
                return TRUE;
        }
 
index 711c045ab6d53a1e7c498f2cc720e37b9fddd1bd..42672e9f748d33439ae57310f62e7885e4268d76 100644 (file)
@@ -802,10 +802,6 @@ check_statfile_conf (struct config_file *cfg, struct statfile *c)
        if (c == NULL) {
                c = memory_pool_alloc0 (cfg->cfg_pool, sizeof (struct statfile));
        }
-       if (c->opts == NULL) {
-               c->opts = g_hash_table_new (rspamd_str_hash, rspamd_str_equal);
-               memory_pool_add_destructor (cfg->cfg_pool, (pool_destruct_func) g_hash_table_destroy, c->opts);
-       }
 
        return c;
 }
index c183e620924fc08b0fa9a301614d69fcd6cc35ac..ffe9b80272393578e40df18713c83aacfa037048 100644 (file)
@@ -910,7 +910,8 @@ rspamd_xml_text (GMarkupParseContext *context, const gchar *text, gsize text_len
 
        top = ud->parent_pointer[ud->nested - 1];
        ud->parent_pointer[ud->nested - 1] =
-                       ucl_object_insert_key (top, ucl_object_fromstring_common (text, text_len, UCL_STRING_PARSE),
+                       ucl_object_insert_key (top, ucl_object_fromstring_common (text, text_len,
+                                       UCL_STRING_PARSE|UCL_STRING_PARSE_BYTES),
                                        ud->section_name[ud->nested], 0, true);
 }
 
index 33e7ea9f27aaccfecbb65f136c5eefac53f3474c..be574319aa1a1f7caf9668ab2c1595855a3849f9 100644 (file)
@@ -381,14 +381,15 @@ static gint
 lua_statfile_get_param (lua_State *L)
 {
        struct statfile                *st = lua_check_statfile (L);
-       const gchar                    *param, *value;
+       const gchar                    *param;
+       ucl_object_t                    *value;
 
        param = luaL_checkstring (L, 2);
 
        if (st != NULL && param != NULL) {
-               value = g_hash_table_lookup (st->opts, param);
+               value = ucl_object_find_key (st->opts, param);
                if (value != NULL) {
-                       lua_pushstring (L, value);
+                       lua_pushstring (L, ucl_object_tostring_forced (value));
                        return 1;
                }
        }