diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2022-10-20 01:16:05 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2022-10-20 01:16:05 +0000 |
commit | e69ab60a3d3efb7f0cfc24f6145c5d3651c5c780 (patch) | |
tree | edaef71e207c551ff57e491056649f6199bd5e42 /usr.sbin/smtpd | |
parent | ef43b3bb9f73f8ce20c1e01e6e3a2bbeeca5923f (diff) |
Display the correct recipient in a Received: header with one recipient.
If multiple recipients are specified but only one is valid, use the
first entry in the recipient list for the Received: header, not the
value from the last "RCPT TO:" command (which could be invalid).
From Chris Waddey
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 13756932208..72e13e8fd8d 100644 --- a/usr.sbin/smtpd/smtp_session.c +++ b/usr.sbin/smtpd/smtp_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp_session.c,v 1.432 2021/07/01 07:42:16 eric Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.433 2022/10/20 01:16:04 millert Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -2732,6 +2732,7 @@ static void smtp_message_begin(struct smtp_tx *tx) { struct smtp_session *s; + struct smtp_rcpt *rcpt; int (*m_printf)(struct smtp_tx *, const char *, ...); m_printf = smtp_message_printf; @@ -2781,9 +2782,10 @@ smtp_message_begin(struct smtp_tx *tx) } if (tx->rcptcount == 1) { + rcpt = TAILQ_FIRST(&tx->rcpts); m_printf(tx, "\n\tfor <%s@%s>", - tx->evp.rcpt.user, - tx->evp.rcpt.domain); + rcpt->maddr.user, + rcpt->maddr.domain); } m_printf(tx, ";\n\t%s\n", time_to_text(time(&tx->time))); |