dovecot-2.0: lda: Log destination address and its source with ma...

dovecot at dovecot.org dovecot at dovecot.org
Wed May 11 14:35:24 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/8f605efb15ce
changeset: 12791:8f605efb15ce
user:      Timo Sirainen <tss at iki.fi>
date:      Wed May 11 14:35:15 2011 +0300
description:
lda: Log destination address and its source with mail_debug=yes

diffstat:

 src/lda/main.c |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (43 lines):

diff -r 370bf3d2d54f -r 8f605efb15ce src/lda/main.c
--- a/src/lda/main.c	Wed May 11 14:24:18 2011 +0300
+++ b/src/lda/main.c	Wed May 11 14:35:15 2011 +0300
@@ -221,7 +221,7 @@
 	struct istream *input;
 	struct mailbox_transaction_context *t;
 	struct mailbox_header_lookup_ctx *headers_ctx;
-	const char *user_source = "";
+	const char *user_source = "", *destaddr_source = "";
 	void **sets;
 	uid_t process_euid;
 	bool stderr_rejection = FALSE;
@@ -266,6 +266,7 @@
 		case 'a':
 			/* original recipient address */
 			ctx.dest_addr = optarg;
+			destaddr_source = "-a parameter";
 			break;
 		case 'd':
 			/* destination user */
@@ -422,14 +423,22 @@
 	    *ctx.set->lda_original_recipient_header != '\0') {
 		ctx.dest_addr = mail_deliver_get_address(ctx.src_mail,
 					ctx.set->lda_original_recipient_header);
+		destaddr_source = t_strconcat(
+			ctx.set->lda_original_recipient_header, " header", NULL);
 	}
 	if (ctx.dest_addr == NULL) {
 		ctx.dest_addr = strchr(user, '@') != NULL ? user :
 			t_strconcat(user, "@", ctx.set->hostname, NULL);
+		destaddr_source = "user at hostname";
 	}
 	if (ctx.final_dest_addr == NULL)
 		ctx.final_dest_addr = ctx.dest_addr;
 
+	if (ctx.dest_user->mail_debug) {
+		i_debug("Destination address: %s (source: %s)",
+			ctx.dest_addr, destaddr_source);
+	}
+
 	if (mail_deliver(&ctx, &storage) < 0) {
 		if (storage == NULL) {
 			/* This shouldn't happen */


More information about the dovecot-cvs mailing list