dovecot-2.0: zlib: Fixed the check to disallow saving messages t...

dovecot at dovecot.org dovecot at dovecot.org
Fri Feb 19 14:23:08 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/fce6ee7ab18f
changeset: 10770:fce6ee7ab18f
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Feb 19 14:22:19 2010 +0200
description:
zlib: Fixed the check to disallow saving messages that look compressed.

diffstat:

 src/plugins/zlib/zlib-plugin.c |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r 97a4289d6d4b -r fce6ee7ab18f src/plugins/zlib/zlib-plugin.c
--- a/src/plugins/zlib/zlib-plugin.c	Fri Feb 19 14:11:21 2010 +0200
+++ b/src/plugins/zlib/zlib-plugin.c	Fri Feb 19 14:22:19 2010 +0200
@@ -131,13 +131,19 @@
 				   struct message_size *body_size,
 				   struct istream **stream_r)
 {
+	struct zlib_user *zuser = ZLIB_USER_CONTEXT(_mail->box->storage->user);
 	struct mail_private *mail = (struct mail_private *)_mail;
 	struct index_mail *imail = (struct index_mail *)mail;
 	union mail_module_context *zmail = ZLIB_MAIL_CONTEXT(mail);
 	struct istream *input;
 	const struct zlib_handler *handler;
 
-	if (imail->data.stream != NULL) {
+	/* don't uncompress input when we are reading a mail that we're just
+	   in the middle of saving, and we didn't do the compression ourself.
+	   in such situation we're probably checking if the user-given input
+	   looks compressed */
+	if (imail->data.stream != NULL ||
+	    (_mail->uid == 0 && zuser->save_handler == NULL)) {
 		return zmail->super.get_stream(_mail, hdr_size, body_size,
 					       stream_r);
 	}


More information about the dovecot-cvs mailing list