mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 07:54:40 +03:00
dkim selectors shouldn't be interpreted as idna
given they are not part of the domain name (to which idna applies). only the part after _domainkey may be idna. found after going through code after report about mx targets with underscores from richard g.
This commit is contained in:
@ -206,12 +206,12 @@ func (p *parser) xdomainselector(isselector bool) dns.Domain {
|
||||
for p.hasPrefix(".") {
|
||||
s += p.xtake(".") + p.xtakefn1(false, subdomain)
|
||||
}
|
||||
if isselector {
|
||||
// Not to be interpreted as IDNA.
|
||||
return dns.Domain{ASCII: strings.ToLower(s)}
|
||||
}
|
||||
d, err := dns.ParseDomain(s)
|
||||
if err != nil {
|
||||
// ParseDomain does not allow underscore, work around it.
|
||||
if strings.Contains(s, "_") && isselector && !moxvar.Pedantic {
|
||||
return dns.Domain{ASCII: strings.ToLower(s)}
|
||||
}
|
||||
p.xerrorf("parsing domain %q: %s", s, err)
|
||||
}
|
||||
return d
|
||||
|
Reference in New Issue
Block a user