]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[CritFix] Fix adding symbols to their primary groups
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 17 Nov 2018 14:38:45 +0000 (14:38 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 17 Nov 2018 14:38:45 +0000 (14:38 +0000)
src/libserver/cfg_utils.c

index b874d439e685253e66bfa7f57b8c4144866d911f..550e4b730e62893a86f9422de8076a94cf4cc7c4 100644 (file)
@@ -1558,11 +1558,13 @@ rspamd_config_new_symbol (struct rspamd_config *cfg, const gchar *symbol,
        /* Search for symbol group */
        if (group == NULL) {
                group = "ungrouped";
-       }
-
-       if (strcmp (group, "ungrouped") == 0) {
                sym_def->flags |= RSPAMD_SYMBOL_FLAG_UNGROUPPED;
        }
+       else {
+               if (strcmp (group, "ungrouped") == 0) {
+                       sym_def->flags |= RSPAMD_SYMBOL_FLAG_UNGROUPPED;
+               }
+       }
 
        sym_group = g_hash_table_lookup (cfg->groups, group);
        if (sym_group == NULL) {
@@ -1572,6 +1574,10 @@ rspamd_config_new_symbol (struct rspamd_config *cfg, const gchar *symbol,
 
        sym_def->gr = sym_group;
        g_hash_table_insert (sym_group->symbols, sym_def->name, sym_def);
+
+       if (!(sym_def->flags & RSPAMD_SYMBOL_FLAG_UNGROUPPED)) {
+               g_ptr_array_add (sym_def->groups, sym_group);
+       }
 }