From 9e4160d67be52b10683e4f6fd46cdad2ee3c6005 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan.bosch@open-xchange.com> Date: Tue, 10 Aug 2021 17:31:30 +0200 Subject: [PATCH] lib-sieve: sieve-result - Fix omission of action finalization happening upon result execution failure. This occurred because the code that checks for a deferred keep action in sieve_result_implicit_keep_execute() could end up "finding" an action that wasn't actually a deferred keep. That action was then erroneously promoted to the FINALIZED state, which meant that commit/rollback was never executed. --- src/lib-sieve/sieve-result.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib-sieve/sieve-result.c b/src/lib-sieve/sieve-result.c index 90a9b75f0..55eb9f54b 100644 --- a/src/lib-sieve/sieve-result.c +++ b/src/lib-sieve/sieve-result.c @@ -1539,10 +1539,13 @@ sieve_result_implicit_keep_execute(struct sieve_result_execution *rexec, /* Scan for deferred keep */ aexec = rexec->actions_tail; - while (aexec != NULL && - aexec->state >= SIEVE_ACTION_EXECUTION_STATE_EXECUTED) { + while (aexec != NULL) { struct sieve_result_action *rac = aexec->action; + if (aexec->state < SIEVE_ACTION_EXECUTION_STATE_EXECUTED) { + aexec = NULL; + break; + } if (rac->action.keep && rac->action.def == NULL) break; aexec = aexec->prev; -- GitLab