From d8bd2c734f5556d9d4f24b2bdc6abe4bc0a51a29 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan.bosch@open-xchange.com> Date: Thu, 9 Jul 2020 02:45:26 +0200 Subject: [PATCH] lib-sieve: plugins: duplicate: Only save duplicate entry when the last script executed successfully. This prevents prematurely marking duplicates when errors occur during result execution. Before, the pending duplicate database changes were committed after each script executed in the sequence. If a later script failed, duplicate tests would mark duplicate messages prematurely. Disadvantage is that actions in earlier scripts that are shielded by a duplicate test can be executed twice erroneously when errors occurred in later scripts in the previous delivery. Still, unexpected duplicate action execution is better than losing mail due to erroneous duplicate detections. Fixing this properly requires extensively restructuring result execution. --- src/lib-sieve/plugins/duplicate/ext-duplicate-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib-sieve/plugins/duplicate/ext-duplicate-common.c b/src/lib-sieve/plugins/duplicate/ext-duplicate-common.c index db3c91829..be2a40b53 100644 --- a/src/lib-sieve/plugins/duplicate/ext-duplicate-common.c +++ b/src/lib-sieve/plugins/duplicate/ext-duplicate-common.c @@ -113,7 +113,7 @@ act_duplicate_mark_finish(const struct sieve_action_exec_env *aenv, bool last, struct act_duplicate_mark_data *data = (struct act_duplicate_mark_data *)aenv->action->context; - if (status != SIEVE_EXEC_OK) + if (!last || status != SIEVE_EXEC_OK) return; /* Message was handled successfully, so track duplicate for this -- GitLab