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!
This commit is contained in:
Mechiel Lukkien 2023-07-28 20:43:44 +02:00
parent 6273afe84f
commit a31dfc573e
No known key found for this signature in database

View file

@ -1203,6 +1203,11 @@ func (c *conn) cmdMail(p *parser) {
}() }()
p.xtake(" FROM:") p.xtake(" FROM:")
// note: no space after colon. ../rfc/5321:1093 // 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() rawRevPath := p.xrawReversePath()
paramSeen := map[string]bool{} paramSeen := map[string]bool{}
for p.space() { for p.space() {
@ -1331,6 +1336,11 @@ func (c *conn) cmdRcpt(p *parser) {
// ../rfc/5321:1985 // ../rfc/5321:1985
p.xtake(" TO:") p.xtake(" TO:")
// note: no space after colon. ../rfc/5321:1093 // 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 var fpath smtp.Path
if p.take("<POSTMASTER>") { if p.take("<POSTMASTER>") {
fpath = smtp.Path{Localpart: "postmaster"} fpath = smtp.Path{Localpart: "postmaster"}