dovecot-2.0: mbox: Use HEADER_FILTER_END_BODY_WITH_LF flag with ...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Jul 30 20:02:22 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/e9f24817d472
changeset: 11909:e9f24817d472
user: Timo Sirainen <tss at iki.fi>
date: Fri Jul 30 18:02:18 2010 +0100
description:
mbox: Use HEADER_FILTER_END_BODY_WITH_LF flag with input stream filter.
This fixes a bug where wrong message size was cached while saving messages
that didn't end with LF.
diffstat:
src/lib-storage/index/mbox/mbox-save.c | 20 ++++----------------
1 files changed, 4 insertions(+), 16 deletions(-)
diffs (44 lines):
diff -r 22e20ccc14bc -r e9f24817d472 src/lib-storage/index/mbox/mbox-save.c
--- a/src/lib-storage/index/mbox/mbox-save.c Fri Jul 30 18:01:34 2010 +0100
+++ b/src/lib-storage/index/mbox/mbox-save.c Fri Jul 30 18:02:18 2010 +0100
@@ -374,7 +374,8 @@
/* filter out unwanted headers and keep track of headers' MD5 sum */
filter = i_stream_create_header_filter(input, HEADER_FILTER_EXCLUDE |
HEADER_FILTER_NO_CR |
- HEADER_FILTER_ADD_MISSING_EOH,
+ HEADER_FILTER_ADD_MISSING_EOH |
+ HEADER_FILTER_END_BODY_WITH_LF,
mbox_save_drop_headers,
mbox_save_drop_headers_count,
save_header_callback, ctx);
@@ -553,17 +554,7 @@
return -1;
}
- if (ctx->last_char != '\n') {
- /* if mail doesn't end with LF, we'll do that.
- otherwise some mbox parsers don't like the result.
- this makes it impossible to save a mail that doesn't
- end with LF though. */
- const char *linefeed =
- ctx->mbox->storage->storage.set->mail_save_crlf ?
- "\r\n" : "\n";
- if (o_stream_send_str(ctx->output, linefeed) < 0)
- return write_error(ctx);
- }
+ i_assert(ctx->last_char == '\n');
return 0;
}
@@ -627,10 +618,7 @@
if (ret == 0)
return 0;
- if (ctx->last_char != '\n') {
- if (o_stream_send(ctx->output, "\n", 1) < 0)
- return write_error(ctx);
- }
+ i_assert(ctx->last_char == '\n');
if (ctx->mbox_md5_ctx) {
unsigned char hdr_md5_sum[16];
More information about the dovecot-cvs
mailing list