From a31dfc573ee3397a9d3841db6408775fc5d772c7 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Fri, 28 Jul 2023 20:43:44 +0200 Subject: [PATCH] in smtpserver, allow a space after "mail from:" and "rcpt to:" commands for submission connections the space is explicitly mentioned as not valid in rfc 5321, but it clients do send it, such as microsoft outlook 365 apps for enterprise. no need to punish such users, we'll allow it. but only for submission, not regular smtp, because it is normally a sign of a spammer. we still don't allow it in pedantic mode (as used by localserve). for issue #51 by hmfaysal, thanks for reporting and testing! --- smtpserver/server.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/smtpserver/server.go b/smtpserver/server.go index 6346e28..0db3fd3 100644 --- a/smtpserver/server.go +++ b/smtpserver/server.go @@ -1203,6 +1203,11 @@ func (c *conn) cmdMail(p *parser) { }() p.xtake(" FROM:") // note: no space after colon. ../rfc/5321:1093 + // Allow illegal space for submission only, not for regular SMTP. Microsoft Outlook + // 365 Apps for Enterprise sends it. + if c.submission && !moxvar.Pedantic { + p.space() + } rawRevPath := p.xrawReversePath() paramSeen := map[string]bool{} for p.space() { @@ -1331,6 +1336,11 @@ func (c *conn) cmdRcpt(p *parser) { // ../rfc/5321:1985 p.xtake(" TO:") // note: no space after colon. ../rfc/5321:1093 + // Allow illegal space for submission only, not for regular SMTP. Microsoft Outlook + // 365 Apps for Enterprise sends it. + if c.submission && !moxvar.Pedantic { + p.space() + } var fpath smtp.Path if p.take("") { fpath = smtp.Path{Localpart: "postmaster"}