spf-query 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +7 -0
- data/lib/spf/query/query.rb +8 -8
- data/lib/spf/query/version.rb +1 -1
- data/spec/query_spec.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5821a96acdc66745d783eaf3e0bb03653892b421
|
4
|
+
data.tar.gz: 74c7214b71a9d14616290e4126a721b0a026734a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71780740178980f74a8ea65be8767e4ce35c3a6158f5c27bff47e1f7bf93a39775914348cb57d84f0f4035190f53a220e362ee020c40e1cd5f73190d85503eeb
|
7
|
+
data.tar.gz: 76f120cbca0b71028519ccbb20aeb32eb50e707c8f82ac707d272be5ac3593005bd295cb675c25f28e2c910d5a95bdcd51bdd63a2861e66c633f259a62ca0ede
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
### 0.1.4 / 2015-12-10
|
2
|
+
|
3
|
+
* Prioritize TXT records on `_spf.example.com` and `example.com` over a SPF
|
4
|
+
record on `example.com`. [RFC 7208] deprecated SPF-type records.
|
5
|
+
(@nandosousafr)
|
6
|
+
|
1
7
|
### 0.1.3 / 2015-10-19
|
2
8
|
|
3
9
|
* Join multi-part DNS responses together with a `' '` instead of nothing.
|
@@ -20,3 +26,4 @@
|
|
20
26
|
* Queries and parses SPF records.
|
21
27
|
* Supports querying both TXT and SPF records.
|
22
28
|
|
29
|
+
[RFC 7208]: https://tools.ietf.org/html/rfc7208#section-3.1
|
data/lib/spf/query/query.rb
CHANGED
@@ -18,14 +18,6 @@ module SPF
|
|
18
18
|
# @api semipublic
|
19
19
|
#
|
20
20
|
def self.query(domain,resolver=Resolv::DNS.new)
|
21
|
-
# check for an SPF record on the domain
|
22
|
-
begin
|
23
|
-
record = resolver.getresource(domain, Resolv::DNS::Resource::IN::SPF)
|
24
|
-
|
25
|
-
return record.strings.join(' ')
|
26
|
-
rescue Resolv::ResolvError
|
27
|
-
end
|
28
|
-
|
29
21
|
# check for SPF in the TXT records
|
30
22
|
["_spf.#{domain}", domain].each do |host|
|
31
23
|
begin
|
@@ -42,6 +34,14 @@ module SPF
|
|
42
34
|
end
|
43
35
|
end
|
44
36
|
|
37
|
+
# check for an SPF record on the domain
|
38
|
+
begin
|
39
|
+
record = resolver.getresource(domain, Resolv::DNS::Resource::IN::SPF)
|
40
|
+
|
41
|
+
return record.strings.join(' ')
|
42
|
+
rescue Resolv::ResolvError
|
43
|
+
end
|
44
|
+
|
45
45
|
return nil
|
46
46
|
end
|
47
47
|
end
|
data/lib/spf/query/version.rb
CHANGED
data/spec/query_spec.rb
CHANGED
@@ -22,7 +22,11 @@ describe SPF::Query do
|
|
22
22
|
context "when the domain has a SPF type record" do
|
23
23
|
let(:domain) { 'getlua.com' }
|
24
24
|
|
25
|
-
it "should prefer the
|
25
|
+
it "should prefer the TXT type record over other SPF records" do
|
26
|
+
expect_any_instance_of(Resolv::DNS).to_not receive(:getresource).with("getlua.com", Resolv::DNS::Resource::IN::SPF)
|
27
|
+
expect_any_instance_of(Resolv::DNS).to receive(:getresources).with("getlua.com", Resolv::DNS::Resource::IN::TXT).at_least(:once).and_call_original
|
28
|
+
expect_any_instance_of(Resolv::DNS).to receive(:getresources).with("_spf.getlua.com", Resolv::DNS::Resource::IN::TXT).at_least(:once).and_call_original
|
29
|
+
|
26
30
|
expect(subject.query(domain)).to be == %{v=spf1 include:_spf.google.com include:mail.zendesk.com include:servers.mcsv.net -all}
|
27
31
|
end
|
28
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spf-query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nicktitle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parslet
|