]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lda: Added -r parameter to specify final recipient address.
authorTimo Sirainen <tss@iki.fi>
Tue, 14 Sep 2010 12:17:18 +0000 (13:17 +0100)
committerTimo Sirainen <tss@iki.fi>
Tue, 14 Sep 2010 12:17:18 +0000 (13:17 +0100)
(As opposed to -a which specifies original recipient address.)
This is going to be used by Sieve checks.

src/lda/main.c
src/lib-lda/mail-deliver.h
src/lmtp/commands.c

index fc7a51710953c6d477670319728812bcd829b085..9cacbde204ff8636bd50880c52674e6fa657f59c 100644 (file)
@@ -251,7 +251,7 @@ int main(int argc, char *argv[])
        master_service = master_service_init("lda",
                MASTER_SERVICE_FLAG_STANDALONE |
                MASTER_SERVICE_FLAG_DONT_LOG_TO_STDERR,
-               &argc, &argv, "a:d:ef:km:p:");
+               &argc, &argv, "a:d:ef:km:p:r:");
 
        memset(&ctx, 0, sizeof(ctx));
        ctx.pool = pool_alloconly_create("mail deliver context", 256);
@@ -262,7 +262,7 @@ int main(int argc, char *argv[])
        while ((c = master_getopt(master_service)) > 0) {
                switch (c) {
                case 'a':
-                       /* destination address */
+                       /* original recipient address */
                        ctx.dest_addr = optarg;
                        break;
                case 'd':
@@ -294,6 +294,10 @@ int main(int argc, char *argv[])
                        /* input path */
                        path = t_abspath(optarg);
                        break;
+               case 'r':
+                       /* final recipient address */
+                       ctx.final_dest_addr = optarg;
+                       break;
                default:
                        print_help();
                        return EX_USAGE;
@@ -409,6 +413,8 @@ int main(int argc, char *argv[])
                                t_strconcat(user, "@", ctx.set->hostname, NULL);
                }
        }
+       if (ctx.final_dest_addr == NULL)
+               ctx.final_dest_addr = ctx.dest_addr;
 
        if (mail_deliver(&ctx, &storage) < 0) {
                if (storage == NULL) {
index e100543ba877106d78a5133d36d8ef723d526ea1..46ca89e6076f284a6c82dccc3813877b813e9f1e 100644 (file)
@@ -21,8 +21,10 @@ struct mail_deliver_context {
 
        /* Destination user */
        struct mail_user *dest_user;
-       /* Destination email address */
+       /* Original recipient address */
        const char *dest_addr;
+       /* Final recipient address (typically same as dest_addr) */
+       const char *final_dest_addr;
        /* Mailbox where mail should be saved, unless e.g. Sieve does
           something to it. */
        const char *dest_mailbox_name;
index 8d4f71560475238096eabe84fad5d3dfda055ee7..cf34a6b578698d9cab572d4e1fa5bc7d589f4b73 100644 (file)
@@ -463,6 +463,7 @@ client_deliver(struct client *client, const struct mail_recipient *rcpt,
        dctx.src_envelope_sender = client->state.mail_from;
        dctx.dest_user = client->state.dest_user;
        dctx.dest_addr = rcpt->address;
+       dctx.final_dest_addr = rcpt->address;
        dctx.dest_mailbox_name = *rcpt->detail == '\0' ? "INBOX" : rcpt->detail;
        dctx.save_dest_mail = array_count(&client->state.rcpt_to) > 1 &&
                client->state.first_saved_mail == NULL;