changeset 14611:4d7dc53d89e7

imap: Fixes to handling BINARY APPENDs.
author Timo Sirainen <tss@iki.fi>
date Wed, 20 Jun 2012 05:41:54 +0300
parents 4bcbb3ff9e35
children 347c2ca867b7
files src/imap/cmd-append.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-append.c	Wed Jun 20 05:39:50 2012 +0300
+++ b/src/imap/cmd-append.c	Wed Jun 20 05:41:54 2012 +0300
@@ -325,6 +325,11 @@
 			args++;
 			if (!imap_arg_get_literal_size(args, &ctx->literal_size))
 				break;
+			if (args->literal8 && !ctx->binary_input) {
+				client_send_tagline(cmd,
+					"NO [UNKNOWN-CTE] Binary input allowed only when the first part is binary.");
+				return -1;
+			}
 			*nonsync_r = args->type == IMAP_ARG_LITERAL_SIZE_NONSYNC;
 			return cmd_append_catenate_text(cmd) < 0 ? -1 : 1;
 		} else {
@@ -644,7 +649,8 @@
 
 	/* [<flags>] [<internal date>] <message literal> */
 	ret = imap_parser_read_args(ctx->save_parser, 0,
-				    IMAP_PARSE_FLAG_LITERAL_SIZE, &args);
+				    IMAP_PARSE_FLAG_LITERAL_SIZE |
+				    IMAP_PARSE_FLAG_LITERAL8, &args);
 	if (ret == -1) {
 		if (!ctx->failed) {
 			msg = imap_parser_get_error(ctx->save_parser, &fatal);