mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 16:33:47 +03:00
fix parsing Authentication-Results header with a "reason=..." part
noticed in gopherwatch logging
This commit is contained in:
parent
73373a19c1
commit
367e968199
2 changed files with 18 additions and 0 deletions
|
@ -424,6 +424,8 @@ func (p *parser) xresinfo(methodKeyword string) (am AuthMethod) {
|
||||||
am.Method, am.Version, am.Result = p.xmethodspec(methodKeyword)
|
am.Method, am.Version, am.Result = p.xmethodspec(methodKeyword)
|
||||||
p.cfws()
|
p.cfws()
|
||||||
if p.take("reason") {
|
if p.take("reason") {
|
||||||
|
p.cfws()
|
||||||
|
p.xtake("=")
|
||||||
p.cfws()
|
p.cfws()
|
||||||
am.Reason = p.xvalue()
|
am.Reason = p.xvalue()
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,6 +311,22 @@ func TestAuthResultsParse(t *testing.T) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const dkimReason = `host.example;
|
||||||
|
dkim=none reason="no dkim signatures"
|
||||||
|
`
|
||||||
|
ar, err = ParseAuthResults(dkimReason)
|
||||||
|
tcheck(t, err, "parsing auth results header")
|
||||||
|
tcompare(t, ar, AuthResults{
|
||||||
|
Hostname: "host.example",
|
||||||
|
Methods: []AuthMethod{
|
||||||
|
{
|
||||||
|
Method: "dkim",
|
||||||
|
Result: "none",
|
||||||
|
Reason: "no dkim signatures",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// Outlook adds an invalid line, missing required hostname at the start. And their
|
// Outlook adds an invalid line, missing required hostname at the start. And their
|
||||||
// dmarc "action=none" is invalid. Nothing to be done.
|
// dmarc "action=none" is invalid. Nothing to be done.
|
||||||
const outlook = `x; spf=pass (sender IP is 84.22.96.237)
|
const outlook = `x; spf=pass (sender IP is 84.22.96.237)
|
||||||
|
|
Loading…
Reference in a new issue