dovecot-2.0: lmtp: Crashfix to multiple RCPT TOs when the first ...

dovecot at dovecot.org dovecot at dovecot.org
Mon Apr 12 19:14:58 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/6b7b2987c41f
changeset: 11131:6b7b2987c41f
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Apr 12 19:14:55 2010 +0300
description:
lmtp: Crashfix to multiple RCPT TOs when the first mail couldn't be used as a copy source.

diffstat:

 src/lmtp/commands.c |  27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)

diffs (40 lines):

diff -r a73f3da6d7a8 -r 6b7b2987c41f src/lmtp/commands.c
--- a/src/lmtp/commands.c	Mon Apr 12 10:59:39 2010 +0300
+++ b/src/lmtp/commands.c	Mon Apr 12 19:14:55 2010 +0300
@@ -604,26 +604,19 @@
 	if (client_open_raw_mail(client, input) < 0)
 		return;
 
-	/* save the message to the first recipient's mailbox */
 	src_mail = client->state.raw_mail;
-	if (!client_deliver_next(client, src_mail)) {
-		/* nothing got saved */
-		i_assert(client->state.first_saved_mail == NULL);
-		return;
+	while (client_deliver_next(client, src_mail)) {
+		if (client->state.first_saved_mail == NULL ||
+		    client->state.first_saved_mail == src_mail)
+			mail_user_unref(&client->state.dest_user);
+		else {
+			/* use the first saved message to save it elsewhere too.
+			   this might allow hard linking the files. */
+			client->state.dest_user = NULL;
+			src_mail = client->state.first_saved_mail;
+		}
 	}
 
-	if (client->state.first_saved_mail == NULL)
-		mail_user_unref(&client->state.dest_user);
-	else {
-		client->state.dest_user = NULL;
-		src_mail = client->state.first_saved_mail;
-	}
-
-	/* use the first saved message to save it elsewhere too.
-	   this might allow hard linking the files. */
-	while (client_deliver_next(client, src_mail))
-		mail_user_unref(&client->state.dest_user);
-
 	if (client->state.first_saved_mail != NULL) {
 		struct mail *mail = client->state.first_saved_mail;
 		struct mailbox_transaction_context *trans = mail->transaction;


More information about the dovecot-cvs mailing list