]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix issue with parent=0
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 17 Mar 2018 15:47:09 +0000 (15:47 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 17 Mar 2018 15:47:09 +0000 (15:47 +0000)
src/libserver/symbols_cache.c
src/lua/lua_config.c

index 8d63b578ba063f29bbc157bd8e00d23e40953b74..18593fa5c75c5e5ce5d2f1840ee8eeb6843f3ad5 100644 (file)
@@ -2369,7 +2369,7 @@ rspamd_symbols_cache_enable_symbol_checkpoint (struct rspamd_task *task,
                clrbit (checkpoint->processed_bits, item->id * 2);
                clrbit (checkpoint->processed_bits, item->id * 2 + 1);
 
-               msg_debug_task ("enable execution of %s", symbol);
+               msg_debug_task ("enable execution of %s (%d)", symbol, id);
        }
        else {
                msg_info_task ("cannot enable %s: not found", symbol);
index d6397efe69520612c12397fa6285cee4466bbe78..3135cc8f4baa3fcbec91ea9ea98b697a382312ff 100644 (file)
@@ -1572,7 +1572,7 @@ lua_config_register_symbol (lua_State * L)
        struct rspamd_config *cfg = lua_check_config (L, 1);
        const gchar *name = NULL, *flags_str = NULL, *type_str = NULL,
                        *description = NULL, *group = NULL;
-       double weight = 0, score = NAN;
+       double weight = 0, score = NAN, parent_float = NAN;
        gboolean one_shot = FALSE, no_squeeze = FALSE;
        gint ret = -1, cbref = -1, type, flags = 0;
        gint64 parent = 0, priority = 0, nshots = 0;
@@ -1580,10 +1580,10 @@ lua_config_register_symbol (lua_State * L)
 
        if (cfg) {
                if (!rspamd_lua_parse_table_arguments (L, 2, &err,
-                               "name=S;weigth=N;callback=F;flags=S;type=S;priority=I;parent=I;"
+                               "name=S;weigth=N;callback=F;flags=S;type=S;priority=I;parent=D;"
                                "score=D;description=S;group=S;one_shot=B;nshots=I;no_squeeze=B",
                                &name, &weight, &cbref, &flags_str, &type_str,
-                               &priority, &parent,
+                               &priority, &parent_float,
                                &score, &description, &group, &one_shot, &nshots, &no_squeeze)) {
                        msg_err_config ("bad arguments: %e", err);
                        g_error_free (err);
@@ -1611,6 +1611,13 @@ lua_config_register_symbol (lua_State * L)
                        type |= lua_parse_symbol_flags (flags_str);
                }
 
+               if (isnan (parent_float)) {
+                       parent = -1;
+               }
+               else {
+                       parent = parent_float;
+               }
+
                ret = rspamd_register_symbol_fromlua (L,
                                cfg,
                                name,
@@ -1618,7 +1625,7 @@ lua_config_register_symbol (lua_State * L)
                                weight == 0 ? 1.0 : weight,
                                priority,
                                type,
-                               parent == 0 ? -1 : parent,
+                               parent,
                                FALSE,
                                no_squeeze);