]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Allow virtual symbols with no parent
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 18 May 2019 13:19:24 +0000 (14:19 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 18 May 2019 13:19:24 +0000 (14:19 +0100)
src/libserver/rspamd_symcache.c
src/lua/lua_config.c

index c36a7e1d7ce3df2a3a77b5771406eb3990d9698a..1d285dc6f24d1b271d7efa81b0f6eb90e5b91b67 100644 (file)
@@ -886,7 +886,7 @@ rspamd_symcache_add_symbol (struct rspamd_symcache *cache,
        if (name == NULL && !(type & SYMBOL_TYPE_CALLBACK)) {
                msg_warn_cache ("no name for non-callback symbol!");
        }
-       else if ((type & SYMBOL_TYPE_VIRTUAL) && parent == -1) {
+       else if ((type & SYMBOL_TYPE_VIRTUAL & (~SYMBOL_TYPE_GHOST)) && parent == -1) {
                msg_warn_cache ("no parent symbol is associated with virtual symbol %s",
                        name);
        }
@@ -976,9 +976,6 @@ rspamd_symcache_add_symbol (struct rspamd_symcache *cache,
                        item->specific.normal.condition_cb = -1;
                }
                else {
-                       /* Require parent */
-                       g_assert (parent != -1);
-
                        item->is_virtual = TRUE;
                        item->specific.virtual.parent = parent;
                        item->id = cache->virtual->len;
index f78a8f4520a16bbd57383bcc59718188d1b9ac43..a60ad8493e536c7490a72d990be06fb15300630a 100644 (file)
@@ -1683,10 +1683,10 @@ lua_config_get_key (lua_State *L)
        return 1;
 }
 
-static gint
+static guint
 lua_parse_symbol_flags (const gchar *str)
 {
-       int ret = 0;
+       guint ret = 0;
 
        if (str) {
                if (strstr (str, "fine") != NULL) {
@@ -1713,6 +1713,9 @@ lua_parse_symbol_flags (const gchar *str)
                if (strstr (str, "trivial") != NULL) {
                        ret |= SYMBOL_TYPE_TRIVIAL;
                }
+               if (strstr (str, "ghost") != NULL) {
+                       ret |= SYMBOL_TYPE_GHOST;
+               }
                if (strstr (str, "mime") != NULL) {
                        ret |= SYMBOL_TYPE_MIME_ONLY;
                }
@@ -1730,10 +1733,10 @@ lua_parse_symbol_flags (const gchar *str)
        return ret;
 }
 
-static gint
+static guint
 lua_parse_symbol_type (const gchar *str)
 {
-       gint ret = SYMBOL_TYPE_NORMAL;
+       guint ret = SYMBOL_TYPE_NORMAL;
        gchar **vec;
        guint i, l;