[dovecot-cvs] dovecot/src/imap imap-fetch-body.c, 1.28.2.1, 1.28.2.2

tss at dovecot.org tss at dovecot.org
Thu Jan 25 15:59:26 UTC 2007


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv17015

Modified Files:
      Tag: branch_1_0
	imap-fetch-body.c 
Log Message:
If we disconnect the client because message ended unexpectedly, log an
error.



Index: imap-fetch-body.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-fetch-body.c,v
retrieving revision 1.28.2.1
retrieving revision 1.28.2.2
diff -u -d -r1.28.2.1 -r1.28.2.2
--- imap-fetch-body.c	28 Dec 2006 18:40:27 -0000	1.28.2.1
+++ imap-fetch-body.c	25 Jan 2007 15:59:23 -0000	1.28.2.2
@@ -115,7 +115,8 @@
 	return str;
 }
 
-static off_t imap_fetch_send(struct ostream *output, struct istream *input,
+static off_t imap_fetch_send(struct imap_fetch_context *ctx,
+			     struct ostream *output, struct istream *input,
 			     bool cr_skipped, uoff_t virtual_size,
 			     bool add_missing_eoh, bool *last_cr)
 {
@@ -195,6 +196,10 @@
 		   and if it was just a temporary error the message would be
 		   permanently left corrupted in client's local cache. So, we
 		   disconnect the client and hope that next try works. */
+		i_error("FETCH for mailbox %s UID %u got too little data: "
+			"%"PRIuUOFF_T" vs %"PRIuUOFF_T,
+			mailbox_get_name(ctx->mail->box), ctx->mail->uid,
+			(uoff_t)sent, virtual_size);
 		o_stream_close(output);
 		return -1;
 	}
@@ -208,7 +213,7 @@
 	off_t ret;
 
 	o_stream_set_max_buffer_size(ctx->client->output, 4096);
-	ret = imap_fetch_send(ctx->client->output, ctx->cur_input,
+	ret = imap_fetch_send(ctx, ctx->client->output, ctx->cur_input,
 			      ctx->skip_cr, ctx->cur_size - ctx->cur_offset,
 			      ctx->cur_append_eoh, &ctx->skip_cr);
 	o_stream_set_max_buffer_size(ctx->client->output, (size_t)-1);
@@ -251,6 +256,10 @@
 	if (ctx->cur_offset != ctx->cur_size &&
 	    !i_stream_have_bytes_left(ctx->cur_input)) {
 		/* Input stream gave less data than expected */
+		i_error("FETCH for mailbox %s UID %u got too little data: "
+			"%"PRIuUOFF_T" vs %"PRIuUOFF_T,
+			mailbox_get_name(ctx->mail->box), ctx->mail->uid,
+			ctx->cur_offset, ctx->cur_size);
 		o_stream_close(ctx->client->output);
 		return -1;
 	}



More information about the dovecot-cvs mailing list