mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 13:04:38 +03:00
add strict mode when parsing messages, typically enabled for incoming special-use messages like tls/dmarc reports, subjectpass emails
and pass a logger to the message parser, so problems with message parsing get the cid logged.
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
||||
"net/textproto"
|
||||
|
||||
"github.com/mjl-/mox/dns"
|
||||
"github.com/mjl-/mox/mlog"
|
||||
"github.com/mjl-/mox/smtp"
|
||||
)
|
||||
|
||||
@ -16,12 +17,12 @@ import (
|
||||
// From headers may be present. From returns an error if there is not exactly
|
||||
// one address. This address can be used for evaluating a DMARC policy against
|
||||
// SPF and DKIM results.
|
||||
func From(r io.ReaderAt) (raddr smtp.Address, header textproto.MIMEHeader, rerr error) {
|
||||
func From(log *mlog.Log, strict bool, r io.ReaderAt) (raddr smtp.Address, header textproto.MIMEHeader, rerr error) {
|
||||
// ../rfc/7489:1243
|
||||
|
||||
// todo: only allow utf8 if enabled in session/message?
|
||||
|
||||
p, err := Parse(r)
|
||||
p, err := Parse(log, strict, r)
|
||||
if err != nil {
|
||||
// todo: should we continue with p, perhaps headers can be parsed?
|
||||
return raddr, nil, fmt.Errorf("parsing message: %v", err)
|
||||
|
Reference in New Issue
Block a user