dovecot-2.2: imap: More APPEND error handling fixes.

dovecot at dovecot.org dovecot at dovecot.org
Wed Aug 29 19:07:54 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/bfd4e6e08f72
changeset: 14974:bfd4e6e08f72
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Aug 29 19:07:47 2012 +0300
description:
imap: More APPEND error handling fixes.

diffstat:

 src/imap/cmd-append.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 3f83a27a72b8 -r bfd4e6e08f72 src/imap/cmd-append.c
--- a/src/imap/cmd-append.c	Wed Aug 29 18:34:43 2012 +0300
+++ b/src/imap/cmd-append.c	Wed Aug 29 19:07:47 2012 +0300
@@ -294,7 +294,8 @@
 		/* ")" */
 		return 0;
 	}
-	client_send_command_error(cmd, "Invalid arguments.");
+	if (!ctx->failed)
+		client_send_command_error(cmd, "Invalid arguments.");
 	cmd->client->input_skip_line = TRUE;
 	return -1;
 }
@@ -308,9 +309,10 @@
 	ctx->catenate = FALSE;
 	ctx->catchain = NULL;
 
-	if (ctx->save_ctx == NULL) {
+	if (ctx->failed) {
 		/* APPEND has already failed */
-		i_assert(ctx->failed);
+		if (ctx->save_ctx != NULL)
+			mailbox_save_cancel(&ctx->save_ctx);
 	} else {
 		/* do mailbox_save_continue() once more after appending EOF,
 		   to finish any pending reads */
@@ -730,7 +732,10 @@
 		/* finished */
 		i_stream_unref(&ctx->litinput);
 
-		if (ctx->save_ctx == NULL) {
+		if (ctx->failed) {
+			if (ctx->save_ctx != NULL)
+				mailbox_save_cancel(&ctx->save_ctx);
+		} else if (ctx->save_ctx == NULL) {
 			/* failed above */
 			client_send_storage_error(cmd, ctx->storage);
 			ctx->failed = TRUE;


More information about the dovecot-cvs mailing list