also test that external addresses fail to be forged

This commit is contained in:
holger krekel
2023-10-18 15:12:14 +02:00
parent 6701c9749c
commit 8dc05ba7ec
3 changed files with 23 additions and 9 deletions

View File

@@ -80,7 +80,7 @@ def lmtp_handle_DATA(envelope):
_, from_addr = parseaddr(message.get("from").strip().lower())
logging.info(f"mime-from: {from_addr} envelope-from: {envelope.mail_from}")
if envelope.mail_from != from_addr:
res += [f"500 Invalid FROM <{envelope.mail_from}>"]
res += [f"500 Invalid FROM <{from_addr}> for <{envelope.mail_from}>"]
continue
if envelope.mail_from == recipient: