summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2013-01-28 16:32:11 +0000
committerEric Faurot <eric@cvs.openbsd.org>2013-01-28 16:32:11 +0000
commit18f081d15b57c154996bf1f53a74e94c05a550b3 (patch)
tree07375bbc5d32488d6a31de9a904de56b5ad3e65c /usr.sbin
parentd93f7acbba8f260b90d7ca0deebf4521c5699cd7 (diff)
log sender address as "<>" when delivering bounces
ok gilles@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/mda.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c
index 2b4199e6509..19fe77d5095 100644
--- a/usr.sbin/smtpd/mda.c
+++ b/usr.sbin/smtpd/mda.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mda.c,v 1.85 2013/01/26 09:37:23 gilles Exp $ */
+/* $OpenBSD: mda.c,v 1.86 2013/01/28 16:32:10 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -757,6 +757,7 @@ static void
mda_log(const struct envelope *evp, const char *prefix, const char *status)
{
char rcpt[MAX_LINE_SIZE];
+ char sender[MAX_LINE_SIZE];
const char *method;
rcpt[0] = '\0';
@@ -765,6 +766,11 @@ mda_log(const struct envelope *evp, const char *prefix, const char *status)
snprintf(rcpt, sizeof rcpt, "rcpt=<%s@%s>, ",
evp->rcpt.user, evp->rcpt.domain);
+ sender[0] = '\0';
+ if (evp->sender.user[0] || evp->sender.domain[0])
+ snprintf(sender, sizeof(sender), "%s@%s",
+ evp->sender.user, evp->sender.domain);
+
if (evp->agent.mda.method == A_MAILDIR)
method = "maildir";
else if (evp->agent.mda.method == A_MBOX)
@@ -776,10 +782,11 @@ mda_log(const struct envelope *evp, const char *prefix, const char *status)
else
method = "???";
- log_info("delivery: %s for %016" PRIx64 ": from=<%s@%s>, to=<%s@%s>, "
+ log_info("delivery: %s for %016" PRIx64 ": from=<%s>, to=<%s@%s>, "
"%suser=%s, method=%s, delay=%s, stat=%s",
prefix,
- evp->id, evp->sender.user, evp->sender.domain,
+ evp->id,
+ sender,
evp->dest.user, evp->dest.domain,
rcpt,
evp->agent.mda.username, method,