dovecot-2.0: lda: Added -r parameter to specify final recipient ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 14 16:45:07 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/d56a28e83f32
changeset: 12110:d56a28e83f32
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Sep 14 13:17:18 2010 +0100
description:
lda: Added -r parameter to specify final recipient address.
(As opposed to -a which specifies original recipient address.)
This is going to be used by Sieve checks.

diffstat:

 src/lda/main.c             |  10 ++++++++--
 src/lib-lda/mail-deliver.h |   4 +++-
 src/lmtp/commands.c        |   1 +
 3 files changed, 12 insertions(+), 3 deletions(-)

diffs (67 lines):

diff -r d6dc68825427 -r d56a28e83f32 src/lda/main.c
--- a/src/lda/main.c	Tue Sep 14 11:06:44 2010 +0100
+++ b/src/lda/main.c	Tue Sep 14 13:17:18 2010 +0100
@@ -251,7 +251,7 @@
 	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 @@
 	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 @@
 			/* 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 @@
 				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) {
diff -r d6dc68825427 -r d56a28e83f32 src/lib-lda/mail-deliver.h
--- a/src/lib-lda/mail-deliver.h	Tue Sep 14 11:06:44 2010 +0100
+++ b/src/lib-lda/mail-deliver.h	Tue Sep 14 13:17:18 2010 +0100
@@ -21,8 +21,10 @@
 
 	/* 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;
diff -r d6dc68825427 -r d56a28e83f32 src/lmtp/commands.c
--- a/src/lmtp/commands.c	Tue Sep 14 11:06:44 2010 +0100
+++ b/src/lmtp/commands.c	Tue Sep 14 13:17:18 2010 +0100
@@ -463,6 +463,7 @@
 	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;


More information about the dovecot-cvs mailing list