]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: Crashfix to multiple RCPT TOs when the first mail couldn't be used as a copy...
authorTimo Sirainen <tss@iki.fi>
Mon, 12 Apr 2010 16:14:55 +0000 (19:14 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 12 Apr 2010 16:14:55 +0000 (19:14 +0300)
--HG--
branch : HEAD

src/lmtp/commands.c

index e8212e4e1c697de418458ebd9537d5ab654d606a..8b9a9c478a9248dd555bdc8c4397f0cad566bd50 100644 (file)
@@ -604,26 +604,19 @@ client_input_data_write_local(struct client *client, struct istream *input)
        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;
-       }
-
-       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;
+       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;
+               }
        }
 
-       /* 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;