mirror of
https://github.com/mjl-/mox.git
synced 2025-07-14 18:54:37 +03:00
for localserve, validate the incoming message
it must be completely parsable. normally, if we receive a message that we cannot fully parse, we accept it and treat it as opaque application/octet-stream. also make it more clear that localserve accepts email intended for any email address.
This commit is contained in:
@ -1515,6 +1515,18 @@ func (c *conn) cmdData(p *parser) {
|
||||
}
|
||||
}
|
||||
|
||||
if Localserve {
|
||||
// Require that message can be parsed fully.
|
||||
p, err := message.Parse(dataFile)
|
||||
if err == nil {
|
||||
err = p.Walk(nil)
|
||||
}
|
||||
if err != nil {
|
||||
// ../rfc/6409:541
|
||||
xsmtpUserErrorf(smtp.C554TransactionFailed, smtp.SeMsg6Other0, "malformed message: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare "Received" header.
|
||||
// ../rfc/5321:2051 ../rfc/5321:3302
|
||||
// ../rfc/5321:3311 ../rfc/6531:578
|
||||
|
Reference in New Issue
Block a user