dovecot-2.2: imap: Added more tests to return empty data when FE...

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 17 07:47:27 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/2535dbe7c503
changeset: 14911:2535dbe7c503
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 17 07:47:16 2012 +0300
description:
imap: Added more tests to return empty data when FETCHing invalid MIME parts.

diffstat:

 src/lib-imap-storage/imap-msgpart.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 85b22a4af8d4 -r 2535dbe7c503 src/lib-imap-storage/imap-msgpart.c
--- a/src/lib-imap-storage/imap-msgpart.c	Thu Aug 16 14:57:55 2012 +0300
+++ b/src/lib-imap-storage/imap-msgpart.c	Fri Aug 17 07:47:16 2012 +0300
@@ -112,9 +112,14 @@
 			for (; num > 1 && part != NULL; num--)
 				part = part->next;
 		} else {
-			/* only 1 allowed with non-multipart messages */
+			/* only 1 allowed with non-multipart messages.
+			   if the child isn't message/rfc822, the path must be
+			   finished after this. */
 			if (num != 1)
 				part = NULL;
+			else if (*path != '\0' &&
+				 (part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) == 0)
+				part = NULL;
 		}
 
 		if (part != NULL &&
@@ -520,8 +525,14 @@
 	}
 
 	switch (msgpart->fetch_type) {
+	case FETCH_MIME:
+		if (part->parent == NULL) {
+			/* root message has no MIME headers */
+			*part_r = NULL;
+			return 0;
+		}
+		break;
 	case FETCH_FULL:
-	case FETCH_MIME:
 	case FETCH_MIME_BODY:
 		break;
 	case FETCH_HEADER:


More information about the dovecot-cvs mailing list