From: Vsevolod Stakhov Date: Sat, 18 May 2019 13:19:24 +0000 (+0100) Subject: [Minor] Allow virtual symbols with no parent X-Git-Tag: 2.0~887 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc3d35d4faa1572d5f92b7b08532ed42feb7176a;p=thirdparty%2Frspamd.git [Minor] Allow virtual symbols with no parent --- diff --git a/src/libserver/rspamd_symcache.c b/src/libserver/rspamd_symcache.c index c36a7e1d7c..1d285dc6f2 100644 --- a/src/libserver/rspamd_symcache.c +++ b/src/libserver/rspamd_symcache.c @@ -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; diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index f78a8f4520..a60ad8493e 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -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;