dovecot-2.2: lib-storage: "Message has no NUL characters" flag w...
dovecot at dovecot.org
dovecot at dovecot.org
Wed May 28 01:21:56 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/0f618da2024b
changeset: 17415:0f618da2024b
user: Timo Sirainen <tss at iki.fi>
date: Wed May 28 04:20:58 2014 +0300
description:
lib-storage: "Message has no NUL characters" flag was being set wrong to cache file.
Only the first MIME part was checked for its existence.
When this flag was wrong, IMAP FETCH may have returned NUL characters
instead of converting them to 0x80 character. This apparently caused Outlook
to hang.
diffstat:
src/lib-storage/index/index-mail.c | 17 +++++++++++++++--
src/lib-storage/index/index-mail.h | 4 +++-
2 files changed, 18 insertions(+), 3 deletions(-)
diffs (55 lines):
diff -r 30a0f18b60dc -r 0f618da2024b src/lib-storage/index/index-mail.c
--- a/src/lib-storage/index/index-mail.c Tue May 27 23:11:07 2014 +0300
+++ b/src/lib-storage/index/index-mail.c Wed May 28 04:20:58 2014 +0300
@@ -95,6 +95,19 @@
return parts;
}
+static bool message_parts_have_nuls(const struct message_part *part)
+{
+ for (; part != NULL; part = part->next) {
+ if ((part->flags & MESSAGE_PART_FLAG_HAS_NULS) != 0)
+ return TRUE;
+ if (part->children != NULL) {
+ if (message_parts_have_nuls(part->children))
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
static bool get_cached_parts(struct index_mail *mail)
{
struct message_part *part;
@@ -106,7 +119,7 @@
return FALSE;
/* we know the NULs now, update them */
- if ((part->flags & MESSAGE_PART_FLAG_HAS_NULS) != 0) {
+ if (message_parts_have_nuls(part)) {
mail->mail.mail.has_nuls = TRUE;
mail->mail.mail.has_no_nuls = FALSE;
} else {
@@ -580,7 +593,7 @@
MAIL_CACHE_FLAG_BINARY_BODY |
MAIL_CACHE_FLAG_HAS_NULS |
MAIL_CACHE_FLAG_HAS_NO_NULS);
- if ((data->parts->flags & MESSAGE_PART_FLAG_HAS_NULS) != 0) {
+ if (message_parts_have_nuls(data->parts)) {
_mail->has_nuls = TRUE;
_mail->has_no_nuls = FALSE;
cache_flags |= MAIL_CACHE_FLAG_HAS_NULS;
diff -r 30a0f18b60dc -r 0f618da2024b src/lib-storage/index/index-mail.h
--- a/src/lib-storage/index/index-mail.h Tue May 27 23:11:07 2014 +0300
+++ b/src/lib-storage/index/index-mail.h Wed May 28 04:20:58 2014 +0300
@@ -43,7 +43,9 @@
/* Mail header or body is known to contain NUL characters. */
MAIL_CACHE_FLAG_HAS_NULS = 0x0004,
/* Mail header or body is known to not contain NUL characters. */
- MAIL_CACHE_FLAG_HAS_NO_NULS = 0x0008,
+ MAIL_CACHE_FLAG_HAS_NO_NULS = 0x0020,
+ /* obsolete _HAS_NO_NULS flag, which was being set incorrectly */
+ MAIL_CACHE_FLAG_HAS_NO_NULS_BROKEN = 0x0008,
/* BODY is IMAP_BODY_PLAIN_7BIT_ASCII and rest of BODYSTRUCTURE
fields are NIL */
More information about the dovecot-cvs
mailing list