dovecot-2.2-pigeonhole: lib-sieve: Omitted handling errors from ...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Fri Oct 10 22:42:57 UTC 2014


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/7f079d92a674
changeset: 1919:7f079d92a674
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sat Oct 11 00:42:39 2014 +0200
description:
lib-sieve: Omitted handling errors from mail_get_headers() in message header stringlist.
Mail storage errors now trigger a runtime error.

diffstat:

 src/lib-sieve/sieve-message.c |  29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diffs (47 lines):

diff -r fe7ce895158b -r 7f079d92a674 src/lib-sieve/sieve-message.c
--- a/src/lib-sieve/sieve-message.c	Wed Oct 08 00:32:28 2014 +0200
+++ b/src/lib-sieve/sieve-message.c	Sat Oct 11 00:42:39 2014 +0200
@@ -22,6 +22,7 @@
 #include "sieve-extensions.h"
 #include "sieve-runtime.h"
 #include "sieve-runtime-trace.h"
+#include "sieve-interpreter.h"
 #include "sieve-address.h"
 
 #include "sieve-message.h"
@@ -536,19 +537,23 @@
 
 		/* Fetch all matching headers from the e-mail */
 		if ( strlist->mime_decode ) {
-			if ( mail_get_headers_utf8(mail, str_c(hdr_item), &strlist->headers) < 0 ||
-				( strlist->headers != NULL && strlist->headers[0] == NULL ) ) {
-				/* Try next item when this fails somehow */
-				strlist->headers = NULL;
-				continue;
-			}
+			ret = mail_get_headers_utf8(mail, str_c(hdr_item), &strlist->headers);			
 		} else {
-			if ( mail_get_headers(mail, str_c(hdr_item), &strlist->headers) < 0 ||
-				( strlist->headers != NULL && strlist->headers[0] == NULL ) ) {
-				/* Try next item when this fails somehow */
-				strlist->headers = NULL;
-				continue;
-			}
+			ret = mail_get_headers(mail, str_c(hdr_item), &strlist->headers);
+		}
+
+		if (ret < 0) {
+			sieve_runtime_critical(renv, NULL,
+				"failed to read header field",
+				"failed to read header field `%s': %s",
+				str_c(hdr_item), mailbox_get_last_error(mail->box, NULL));
+			_strlist->exec_status = SIEVE_EXEC_FAILURE;
+			return -1;
+		}
+
+		if ( strlist->headers == NULL || strlist->headers[0] == NULL ) {
+			/* Try next item when no headers found */
+			strlist->headers = NULL;
 		}
 	}
 


More information about the dovecot-cvs mailing list