zaccone / spf

Sender Policy Framework
MIT License
20 stars 6 forks source link

CheckHost(...) returns unexpected result on Windows when SPF record is split. #32

Open cedar10bits opened 7 years ago

cedar10bits commented 7 years ago

On Windows, if SPF record is split, CheckHost(...) returns unexpected result. For example, domain "example.test.local" has TXT record like below.

# dig example.test.local txt
;; ANSWER SECTION:
example.test.local.     0       IN      TXT     "v=spf1 ip4:1.2.3.4 " "~all"

If IP is 1.2.3.5 and domain is "example.test.local", CheckHost(...) returns "softfal" on Linux. But on Windows, CheckHost(...) returns "neutral".

Related issue. https://github.com/golang/go/issues/21472

cedar10bits commented 7 years ago

On Windows, net.LookupTXT regards a TXT record with multiple strings as multiple records. Unfortunately, net.LookupTXT won't be fixed (but maybe replaced by new other function in the future). So, if domain name has a TXT record with multiple strings, CheckHost may return unexpected result, like neutral or so.