diff src/lda/main.c @ 12110:d56a28e83f32

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.
author Timo Sirainen <tss@iki.fi>
date Tue, 14 Sep 2010 13:17:18 +0100
parents 69a3dfe6dba3
children 8bd2bd410c73
line wrap: on
line diff
--- 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) {