]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Another fix for nested composites
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 22 Jun 2018 13:50:13 +0000 (14:50 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 22 Jun 2018 13:50:13 +0000 (14:50 +0100)
src/libserver/composites.c

index f0a079b7bdccd6b7d9d36a041625226cb653c0b0..67ed71149f7b9da65efacb1836ed7304bbc3fea2 100644 (file)
@@ -69,6 +69,7 @@ static rspamd_expression_atom_t * rspamd_composite_expr_parse (const gchar *line
 static gdouble rspamd_composite_expr_process (gpointer input, rspamd_expression_atom_t *atom);
 static gint rspamd_composite_expr_priority (rspamd_expression_atom_t *atom);
 static void rspamd_composite_expr_destroy (rspamd_expression_atom_t *atom);
+static void composites_foreach_callback (gpointer key, gpointer value, void *data);
 
 const struct rspamd_atom_subr composite_expr_subr = {
        .parse = rspamd_composite_expr_parse,
@@ -136,19 +137,14 @@ rspamd_composite_process_single_symbol (struct composites_data *cd,
                                                sym, cd->composite->sym);
                                /* Set checked for this symbol to avoid cyclic references */
                                setbit (cd->checked, cd->composite->id * 2);
-                               saved = cd->composite;
-                               cd->composite = ncomp;
-                               rc = rspamd_process_expression (ncomp->expr,
-                                               RSPAMD_EXPRESSION_FLAG_NOOPT, cd);
+                               saved = cd->composite; /* Save the current composite */
+                               composites_foreach_callback ((gpointer)ncomp->sym, ncomp, cd);
+
+                               /* Restore state */
                                cd->composite = saved;
                                clrbit (cd->checked, cd->composite->id * 2);
 
-                               if (rc != 0) {
-                                       setbit (cd->checked, ncomp->id * 2 + 1);
-                                       ms = g_hash_table_lookup (cd->metric_res->symbols, sym);
-                               }
-
-                               setbit (cd->checked, ncomp->id * 2);
+                               ms = g_hash_table_lookup (cd->metric_res->symbols, sym);
                        }
                        else {
                                /*