dovecot-2.2: imap: Fixes to handling BINARY APPENDs.

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 20 05:42:01 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/4d7dc53d89e7
changeset: 14611:4d7dc53d89e7
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 20 05:41:54 2012 +0300
description:
imap: Fixes to handling BINARY APPENDs.

diffstat:

 src/imap/cmd-append.c |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (25 lines):

diff -r 4bcbb3ff9e35 -r 4d7dc53d89e7 src/imap/cmd-append.c
--- 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);


More information about the dovecot-cvs mailing list