From: Stephan Bosch Date: Wed, 12 Apr 2017 08:13:15 +0000 (+0200) Subject: lib-imap: imap-bodystructure: Fixed handling of a multipart part without children... X-Git-Tag: 2.2.29.1~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a3a6667c8e0ce175d4de2cadf8e43dad111aa3d8;p=thirdparty%2Fdovecot%2Fcore.git lib-imap: imap-bodystructure: Fixed handling of a multipart part without children in imap_bodystructure_write(). In that case it writes an empty text/plain part to prevent generating an invalid BODYSTRUCURE. However, it always generated the basic BODY version without the extra fields for a full BODYSTRUCTURE. --- diff --git a/src/lib-imap/imap-bodystructure.c b/src/lib-imap/imap-bodystructure.c index 73c3ff512f..2e58f40741 100644 --- a/src/lib-imap/imap-bodystructure.c +++ b/src/lib-imap/imap-bodystructure.c @@ -13,8 +13,11 @@ #include "imap-envelope.h" #include "imap-bodystructure.h" -#define EMPTY_BODYSTRUCTURE "(\"text\" \"plain\" " \ +#define EMPTY_BODY "(\"text\" \"plain\" " \ "(\"charset\" \""MESSAGE_PART_DEFAULT_CHARSET"\") NIL NIL \"7bit\" 0 0)" +#define EMPTY_BODYSTRUCTURE "(\"text\" \"plain\" " \ + "(\"charset\" \""MESSAGE_PART_DEFAULT_CHARSET"\") NIL NIL \"7bit\" 0 0 " \ + "NIL NIL NIL NIL)" /* * IMAP BODY/BODYSTRUCTURE write @@ -118,7 +121,10 @@ static void part_write_body_multipart(const struct message_part *part, /* no parts in multipart message, that's not allowed. write a single 0-length text/plain structure */ - str_append(str, EMPTY_BODYSTRUCTURE); + if (!extended) + str_append(str, EMPTY_BODY); + else + str_append(str, EMPTY_BODYSTRUCTURE); } str_append_c(str, ' ');