dovecot-2.2-pigeonhole: LDA Sieve plugin: Fixed handling of temp...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Fri Oct 10 23:33:22 UTC 2014


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/8c4c5dfe718d
changeset: 1921:8c4c5dfe718d
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sat Oct 11 01:33:15 2014 +0200
description:
LDA Sieve plugin: Fixed handling of temporary SMTP errors.
These caused a BUG error to be reported during delivery.
Solved by signalling the occurrence of storage errors as a separate execution status flag, rather than querying the last storage itself for errors, which won't work.

diffstat:

 src/lib-sieve/sieve-actions.c            |  15 ++++++++++++---
 src/lib-sieve/sieve-result.c             |   2 +-
 src/lib-sieve/sieve-types.h              |  10 ++++++----
 src/plugins/lda-sieve/lda-sieve-plugin.c |   3 ++-
 4 files changed, 21 insertions(+), 9 deletions(-)

diffs (99 lines):

diff -r 9fce6189be6c -r 8c4c5dfe718d src/lib-sieve/sieve-actions.c
--- a/src/lib-sieve/sieve-actions.c	Sat Oct 11 00:44:27 2014 +0200
+++ b/src/lib-sieve/sieve-actions.c	Sat Oct 11 01:33:15 2014 +0200
@@ -409,7 +409,8 @@
 	 * to NULL. This implementation will then skip actually storing the message.
 	 */
 	if ( senv->user != NULL ) {
-		if ( !act_store_mailbox_open(aenv, ctx->mailbox, &box, &error_code, &error) ) {
+		if ( !act_store_mailbox_open
+			(aenv, ctx->mailbox, &box, &error_code, &error) ) {
 			open_failed = TRUE;
 		}
 	} else {
@@ -697,6 +698,8 @@
 	/* Note the fact that the message was stored at least once */
 	if ( status )
 		aenv->exec_status->message_saved = TRUE;
+	else
+		aenv->exec_status->store_failed = TRUE;
 
 	/* Log our status */
 	act_store_log_status(trans, aenv, FALSE, status);
@@ -722,6 +725,13 @@
 	struct act_store_transaction *trans =
 		(struct act_store_transaction *) tr_context;
 
+	i_assert( trans->box != NULL );
+
+	if (!success) {
+		aenv->exec_status->last_storage = mailbox_get_storage(trans->box);
+		aenv->exec_status->store_failed = TRUE;
+	}
+
 	/* Log status */
 	act_store_log_status(trans, aenv, TRUE, success);
 
@@ -734,8 +744,7 @@
 		mailbox_transaction_rollback(&trans->mail_trans);
 
 	/* Close the mailbox */
-	if ( trans->box != NULL )
-		mailbox_free(&trans->box);
+	mailbox_free(&trans->box);
 }
 
 /*
diff -r 9fce6189be6c -r 8c4c5dfe718d src/lib-sieve/sieve-result.c
--- a/src/lib-sieve/sieve-result.c	Sat Oct 11 00:44:27 2014 +0200
+++ b/src/lib-sieve/sieve-result.c	Sat Oct 11 01:33:15 2014 +0200
@@ -1143,7 +1143,6 @@
 			act->def->execute != NULL ) {
 			status = act->def->execute
 				(act, &result->action_env, rac->tr_context);
-			rac->success = ( status == SIEVE_EXEC_OK );
 		}
 
 		/* Execute post-execute event of side effects */
@@ -1156,6 +1155,7 @@
 			rsef = rsef->next;
 		}
 
+		rac->success = ( status == SIEVE_EXEC_OK );
 		rac = rac->next;
 	}
 
diff -r 9fce6189be6c -r 8c4c5dfe718d src/lib-sieve/sieve-types.h
--- a/src/lib-sieve/sieve-types.h	Sat Oct 11 00:44:27 2014 +0200
+++ b/src/lib-sieve/sieve-types.h	Sat Oct 11 01:33:15 2014 +0200
@@ -227,11 +227,13 @@
  */
 
 struct sieve_exec_status {
-	bool message_saved;
-	bool message_forwarded;
-	bool tried_default_save;
-	bool keep_original;
 	struct mail_storage *last_storage;
+
+	unsigned int message_saved:1;
+	unsigned int message_forwarded:1;
+	unsigned int tried_default_save:1;
+	unsigned int keep_original:1;
+	unsigned int store_failed:1;
 };
 
 /*
diff -r 9fce6189be6c -r 8c4c5dfe718d src/plugins/lda-sieve/lda-sieve-plugin.c
--- a/src/plugins/lda-sieve/lda-sieve-plugin.c	Sat Oct 11 00:44:27 2014 +0200
+++ b/src/plugins/lda-sieve/lda-sieve-plugin.c	Sat Oct 11 01:33:15 2014 +0200
@@ -381,7 +381,8 @@
 
 	error_func = user_error_func = sieve_sys_error;
 
-	if ( estatus != NULL && estatus->last_storage != NULL ) {
+	if ( estatus != NULL && estatus->last_storage != NULL &&
+		estatus->store_failed) {
 		mail_storage_get_last_error(estatus->last_storage, &mail_error);
 
 		/* Don't bother administrator too much with benign errors */


More information about the dovecot-cvs mailing list