]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lda, lmtp: Use mail_deliver_context.tempfail_error first if it exists (instead of...
authorTimo Sirainen <tss@iki.fi>
Wed, 8 Oct 2014 19:10:34 +0000 (22:10 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 8 Oct 2014 19:10:34 +0000 (22:10 +0300)
src/lda/main.c
src/lmtp/commands.c

index 12ff72478b0c3154d110428ff1cc5c9fda32dc55..7d53b3c28c19563b9bd8414a99c25bb32f5f0a77 100644 (file)
@@ -435,11 +435,11 @@ int main(int argc, char *argv[])
        lda_set_dest_addr(&ctx, user, destaddr_source);
 
        if (mail_deliver(&ctx, &storage) < 0) {
-               if (storage != NULL) {
-                       errstr = mail_storage_get_last_error(storage, &error);
-               } else if (ctx.tempfail_error != NULL) {
+               if (ctx.tempfail_error != NULL) {
                        errstr = ctx.tempfail_error;
                        error = MAIL_ERROR_TEMP;
+               } else if (storage != NULL) {
+                       errstr = mail_storage_get_last_error(storage, &error);
                } else {
                        /* This shouldn't happen */
                        i_error("BUG: Saving failed to unknown storage");
index d1860e6d8f8e13ce3c3419709412311692f19aa6..5efb7464c885c85d5dfb50e3b135264ea55ca5f8 100644 (file)
@@ -694,6 +694,10 @@ client_deliver(struct client *client, const struct mail_recipient *rcpt,
                client_send_line(client, "250 2.0.0 <%s> %s Saved",
                                 rcpt->address, client->state.session_id);
                ret = 0;
+       } else if (dctx.tempfail_error != NULL) {
+               client_send_line(client, "451 4.2.0 <%s> %s",
+                                rcpt->address, dctx.tempfail_error);
+               ret = -1;
        } else if (storage != NULL) {
                error = mail_storage_get_last_error(storage, &mail_error);
                if (mail_error == MAIL_ERROR_NOQUOTA) {
@@ -706,10 +710,6 @@ client_deliver(struct client *client, const struct mail_recipient *rcpt,
                                         rcpt->address, error);
                }
                ret = -1;
-       } else if (dctx.tempfail_error != NULL) {
-               client_send_line(client, "451 4.2.0 <%s> %s",
-                                rcpt->address, dctx.tempfail_error);
-               ret = -1;
        } else {
                /* This shouldn't happen */
                i_error("BUG: Saving failed to unknown storage");