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

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 23 17:02:06 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/f0e077c5c5f3
changeset: 11619:f0e077c5c5f3
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 37df22ecd572 -r f0e077c5c5f3 src/lib-storage/index/index-mail-headers.c
--- a/src/lib-storage/index/index-mail-headers.c	Wed Jun 23 13:38:55 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