dovecot-2.2-pigeonhole: lib-sieve: Fixed bug in handling of bina...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Thu Nov 13 08:36:22 UTC 2014


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/0ecc1c82065c
changeset: 1964:0ecc1c82065c
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Thu Nov 13 09:36:13 2014 +0100
description:
lib-sieve: Fixed bug in handling of binary errors for action side-effects and message overrides.

diffstat:

 src/lib-sieve/sieve-actions.c |  47 +++++++++++++++++++++---------------------
 src/lib-sieve/sieve-actions.h |   7 ++---
 src/lib-sieve/sieve-message.c |  12 +++++-----
 src/lib-sieve/sieve-message.h |   7 ++---
 4 files changed, 36 insertions(+), 37 deletions(-)

diffs (141 lines):

diff -r daa10b2102d2 -r 0ecc1c82065c src/lib-sieve/sieve-actions.c
--- a/src/lib-sieve/sieve-actions.c	Wed Nov 12 22:21:14 2014 +0100
+++ b/src/lib-sieve/sieve-actions.c	Thu Nov 13 09:36:13 2014 +0100
@@ -37,29 +37,6 @@
 const struct sieve_operand_class sieve_side_effect_operand_class =
 	{ "SIDE-EFFECT" };
 
-bool sieve_opr_side_effect_read
-(const struct sieve_runtime_env *renv, sieve_size_t *address,
-	struct sieve_side_effect *seffect)
-{
-	const struct sieve_side_effect_def *sdef;
-
-	seffect->context = NULL;
-
-	if ( !sieve_opr_object_read
-		(renv, &sieve_side_effect_operand_class, address, &seffect->object) )
-		return FALSE;
-
-	sdef = seffect->def =
-		(const struct sieve_side_effect_def *) seffect->object.def;
-
-	if ( sdef->read_context != NULL &&
-		!sdef->read_context(seffect, renv, address, &seffect->context) ) {
-		return FALSE;
-	}
-
-	return TRUE;
-}
-
 bool sieve_opr_side_effect_dump
 (const struct sieve_dumptime_env *denv, sieve_size_t *address)
 {
@@ -84,6 +61,30 @@
 	return TRUE;
 }
 
+int sieve_opr_side_effect_read
+(const struct sieve_runtime_env *renv, sieve_size_t *address,
+	struct sieve_side_effect *seffect)
+{
+	const struct sieve_side_effect_def *sdef;
+	int ret;
+
+	seffect->context = NULL;
+
+	if ( !sieve_opr_object_read
+		(renv, &sieve_side_effect_operand_class, address, &seffect->object) )
+		return SIEVE_EXEC_BIN_CORRUPT;
+
+	sdef = seffect->def =
+		(const struct sieve_side_effect_def *) seffect->object.def;
+
+	if ( sdef->read_context != NULL && (ret=sdef->read_context
+		(seffect, renv, address, &seffect->context)) <= 0 ) {
+		return ret;
+	}
+
+	return SIEVE_EXEC_OK;
+}
+
 /*
  * Optional operands
  */
diff -r daa10b2102d2 -r 0ecc1c82065c src/lib-sieve/sieve-actions.h
--- a/src/lib-sieve/sieve-actions.h	Wed Nov 12 22:21:14 2014 +0100
+++ b/src/lib-sieve/sieve-actions.h	Thu Nov 13 09:36:13 2014 +0100
@@ -187,13 +187,12 @@
 	sieve_opr_object_emit(sblock, ext, &seff->obj_def);
 }
 
-bool sieve_opr_side_effect_read
+bool sieve_opr_side_effect_dump
+	(const struct sieve_dumptime_env *denv, sieve_size_t *address);
+int sieve_opr_side_effect_read
 	(const struct sieve_runtime_env *renv, sieve_size_t *address,
 		struct sieve_side_effect *seffect);
 
-bool sieve_opr_side_effect_dump
-	(const struct sieve_dumptime_env *denv, sieve_size_t *address);
-
 /*
  * Optional operands
  */
diff -r daa10b2102d2 -r 0ecc1c82065c src/lib-sieve/sieve-message.c
--- a/src/lib-sieve/sieve-message.c	Wed Nov 12 22:21:14 2014 +0100
+++ b/src/lib-sieve/sieve-message.c	Thu Nov 13 09:36:13 2014 +0100
@@ -604,27 +604,27 @@
 	return TRUE;
 }
 
-bool sieve_opr_message_override_read
+int sieve_opr_message_override_read
 (const struct sieve_runtime_env *renv, sieve_size_t *address,
 	struct sieve_message_override *svmo)
 {
 	const struct sieve_message_override_def *hodef;
+	int ret;
 
 	svmo->context = NULL;
 
 	if ( !sieve_opr_object_read
 		(renv, &sieve_message_override_operand_class, address, &svmo->object) )
-		return FALSE;
+		return SIEVE_EXEC_BIN_CORRUPT;
 
 	hodef = svmo->def =
 		(const struct sieve_message_override_def *) svmo->object.def;
 
 	if ( hodef->read_context != NULL &&
-		!hodef->read_context(svmo, renv, address, &svmo->context) ) {
-		return FALSE;
-	}
+		(ret=hodef->read_context(svmo, renv, address, &svmo->context)) <= 0 )
+		return ret;
 
-	return TRUE;
+	return SIEVE_EXEC_OK;
 }
 
 /*
diff -r daa10b2102d2 -r 0ecc1c82065c src/lib-sieve/sieve-message.h
--- a/src/lib-sieve/sieve-message.h	Wed Nov 12 22:21:14 2014 +0100
+++ b/src/lib-sieve/sieve-message.h	Thu Nov 13 09:36:13 2014 +0100
@@ -135,13 +135,12 @@
 	sieve_opr_object_emit(sblock, ext, &seff->obj_def);
 }
 
-bool sieve_opr_message_override_read
+bool sieve_opr_message_override_dump
+	(const struct sieve_dumptime_env *denv, sieve_size_t *address);
+int sieve_opr_message_override_read
 	(const struct sieve_runtime_env *renv, sieve_size_t *address,
 		struct sieve_message_override *svmo);
 
-bool sieve_opr_message_override_dump
-	(const struct sieve_dumptime_env *denv, sieve_size_t *address);
-
 /*
  * Optional operands
  */


More information about the dovecot-cvs mailing list