in dkim-signature header, allow FWS anywhere in "z=" (copied headers), and prevent panic in cli command "mox dkim verify" when a dkim-signature cannot be parsed

the BNF for "z=" does not show FWS is allowed (while it does in other places,
eg base64), but the text above the BNF explains it in words.
This commit is contained in:
Mechiel Lukkien
2023-02-03 13:29:47 +01:00
parent 2239f38232
commit ba077dadd0
3 changed files with 67 additions and 40 deletions

View File

@ -213,7 +213,7 @@ func parseSignature(buf []byte, smtputf8 bool) (sig *Sig, verifySig []byte, err
ds := newSigWithDefaults()
seen := map[string]struct{}{}
p := parser{s: string(buf), smtputf8: smtputf8}
name := p.xhdrName()
name := p.xhdrName(false)
if !strings.EqualFold(name, "DKIM-Signature") {
xerrorf("%w", errSigHeader)
}