From: Timo Sirainen Date: Wed, 11 May 2011 11:35:15 +0000 (+0300) Subject: lda: Log destination address and its source with mail_debug=yes X-Git-Tag: 2.0.13~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b969a1fe98fc7da948e7d24654fe853076bf2ea;p=thirdparty%2Fdovecot%2Fcore.git lda: Log destination address and its source with mail_debug=yes --- diff --git a/src/lda/main.c b/src/lda/main.c index 5b71936a4f..6c1dfe541a 100644 --- a/src/lda/main.c +++ b/src/lda/main.c @@ -221,7 +221,7 @@ int main(int argc, char *argv[]) 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 @@ int main(int argc, char *argv[]) case 'a': /* original recipient address */ ctx.dest_addr = optarg; + destaddr_source = "-a parameter"; break; case 'd': /* destination user */ @@ -422,14 +423,22 @@ int main(int argc, char *argv[]) *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@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 */