summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-22 14:50:13 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-22 14:50:13 +0100
commitca1b4f4d477fbc52df8ac5e399949611e8351a8d (patch)
tree66648d070d83e67909eebbd2ef3c428d22df86cf /src
parent8c8b9656c13dcac6b8cb0887a4b884930efbd2cc (diff)
downloadrspamd-ca1b4f4d477fbc52df8ac5e399949611e8351a8d.tar.gz
rspamd-ca1b4f4d477fbc52df8ac5e399949611e8351a8d.zip
[Fix] Another fix for nested composites
Diffstat (limited to 'src')
-rw-r--r--src/libserver/composites.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/libserver/composites.c b/src/libserver/composites.c
index f0a079b7b..67ed71149 100644
--- a/src/libserver/composites.c
+++ b/src/libserver/composites.c
@@ -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 {
/*