add parser of Authentication-Results, and fix bugs it found in our generated headers

we weren't always quoting the values, like dkim's header.b=abc/def. the "/"
requires that the value be quoted.
This commit is contained in:
Mechiel Lukkien
2024-03-13 17:35:53 +01:00
parent b91480b5af
commit 2c9cb5b847
4 changed files with 674 additions and 16 deletions

View File

@ -261,7 +261,6 @@ func (p *parser) xdomain() dns.Domain {
return d
}
// ../rfc/5321:2303
// ../rfc/5321:2303 ../rfc/6531:411
func (p *parser) xsubdomain() string {
return p.xtakefn1("subdomain", func(c rune, i int) bool {
@ -278,9 +277,16 @@ func (p *parser) xmailbox() smtp.Path {
// ../rfc/5321:2307
func (p *parser) xldhstr() string {
return p.xtakefn1("ldh-str", func(c rune, i int) bool {
return c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || i == 0 && c == '-'
s := p.xtakefn1("ldh-str", func(c rune, i int) bool {
return c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '-'
})
if s == "-" {
p.xerrorf("empty ldh-str")
} else if strings.HasSuffix(s, "-") {
p.o--
s = s[:len(s)-1]
}
return s
}
// parse address-literal or domain.