From 422a8f7be4e13c22064b7af04c4e36f96198258d Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Tue, 20 Nov 2007 10:29:40 +0100
Subject: [PATCH] Fixed bug in the command validation.

---
 src/lib-sieve/sieve-validator.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/lib-sieve/sieve-validator.c b/src/lib-sieve/sieve-validator.c
index a53ae6d64..95402b79e 100644
--- a/src/lib-sieve/sieve-validator.c
+++ b/src/lib-sieve/sieve-validator.c
@@ -587,11 +587,13 @@ static bool sieve_validate_test(struct sieve_validator *validator, struct sieve_
 		 					(validator,ctx, test->positional_arguments) ||
 		 				!sieve_validate_command_subtests
 		 					(validator, ctx, test->subtests) ) 
-		 				return FALSE; 
-				
-					/* Call command validation function if specified */
-					if ( test->validate != NULL )
-						result = test->validate(validator, ctx) && result;
+		 			{
+		 				result = FALSE; 
+		 			} else {
+						/* Call command validation function if specified */
+						if ( test->validate != NULL )
+							result = test->validate(validator, ctx) && result;
+					}
 				} else 
 					result = FALSE;
 			}
@@ -665,11 +667,13 @@ static bool sieve_validate_command
 	 						(validator, ctx, command->subtests) || 
 	 					!sieve_validate_command_block
 	 						(validator, ctx, command->block_allowed, command->block_required) ) 
+	 				{
 	 					result = FALSE;
-			
-					/* Call command validation function if specified */
-					if ( command->validate != NULL )
-						result = command->validate(validator, ctx) && result;
+	 				} else {
+						/* Call command validation function if specified */
+						if ( command->validate != NULL )
+							result = command->validate(validator, ctx) && result;
+					}
 				} else
 					result = FALSE;
 			}
-- 
GitLab