From 77cc93281031d15eb15b72c42545fd5b2555158f Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan.bosch@dovecot.fi>
Date: Thu, 24 Jan 2019 22:46:09 +0100
Subject: [PATCH] lib-sieve: Prevent execution of implicit keep upon temporary
 failure occurring at runtime.

---
 src/lib-sieve/sieve.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/lib-sieve/sieve.c b/src/lib-sieve/sieve.c
index 356448993..ab51ad67d 100644
--- a/src/lib-sieve/sieve.c
+++ b/src/lib-sieve/sieve.c
@@ -714,14 +714,16 @@ bool sieve_multiscript_run
 			sieve_multiscript_execute(mscript,
 				action_ehandler, flags, &mscript->keep);
 		}
-		mscript->active =
-			( mscript->active && mscript->keep && mscript->status > 0 );
+		if ( !mscript->keep )
+			mscript->active = FALSE;
 	}
 
-	if ( mscript->status <= 0 )
+	if ( !mscript->active || mscript->status <= 0 ) {
+		mscript->active = FALSE;
 		return FALSE;
+	}
 
-	return mscript->active;
+	return TRUE;
 }
 
 bool sieve_multiscript_will_discard
-- 
GitLab