author | Alberto Bertogli
<albertito@blitiri.com.ar> 2019-10-14 11:11:04 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2019-10-14 12:35:33 UTC |
parent | e7194370b9d9d1bd261aa2a7250fc284159a1595 |
spf.go | +8 | -2 |
diff --git a/spf.go b/spf.go index 72677f7..760ed9e 100644 --- a/spf.go +++ b/spf.go @@ -370,7 +370,7 @@ func (r *resolution) ptrField(res Result, field, domain string) (bool, Result, e if r.ipNames == nil { r.count++ - n, err := lookupAddr(r.ip.String()) + ns, err := lookupAddr(r.ip.String()) if err != nil { // https://tools.ietf.org/html/rfc7208#section-5 if isTemporary(err) { @@ -378,10 +378,16 @@ func (r *resolution) ptrField(res Result, field, domain string) (bool, Result, e } return false, "", err } - r.ipNames = n + for _, n := range ns { + // Append the lower-case variants so we do a case-insensitive + // lookup below. + r.ipNames = append(r.ipNames, strings.ToLower(n)) + } } + ptrDomain = strings.ToLower(ptrDomain) for _, n := range r.ipNames { + trace("ptr evaluating %q in %q", n, ptrDomain) if strings.HasSuffix(n, ptrDomain+".") { return true, res, errMatchedPTR }