dovecot-1.2: lib-storage: When getting decoded headers, don't fa...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 23 17:16:31 EEST 2010


details:   http://hg.dovecot.org/dovecot-1.2/rev/659f72bf92ae
changeset: 9587:659f72bf92ae
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 23 14:59:49 2010 +0100
description:
lib-storage: When getting decoded headers, don't fail when MIME encoded-words expand to LFs.
This fixes errors like: Corrupted index cache file dovecot.index.cache:
Broken header Subject for mail UID 1

diffstat:

 src/lib-storage/index/index-mail-headers.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (23 lines):

diff -r 97b702abd132 -r 659f72bf92ae src/lib-storage/index/index-mail-headers.c
--- a/src/lib-storage/index/index-mail-headers.c	Mon Jun 21 21:17:58 2010 +0100
+++ b/src/lib-storage/index/index-mail-headers.c	Wed Jun 23 14:59:49 2010 +0100
@@ -722,13 +722,14 @@
 	for (i = 0; i < count; i++) {
 		str_truncate(str, 0);
 		input = list[i];
+		/* unfold all lines into a single line */
+		if (unfold_header(mail->data_pool, &input) < 0)
+			return -1;
+
+		/* decode MIME encoded-words. decoding may also add new LFs. */
 		if (message_header_decode_utf8((const unsigned char *)input,
 					       strlen(list[i]), str, FALSE))
-			input = str_c(str);
-		if (unfold_header(mail->data_pool, &input) < 0)
-			return -1;
-		if (input == str->data)
-			input = p_strdup(mail->data_pool, input);
+			input = p_strdup(mail->data_pool, str_c(str));
 		decoded_list[i] = input;
 	}
 	*_list = decoded_list;


More information about the dovecot-cvs mailing list