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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1aaee47c91c92d11223cae3ab6c1be8d72fe2a1a
4
- data.tar.gz: 6e46d9c6fad3583d82060eeb25fdcfcc4e256f0e
3
+ metadata.gz: 5821a96acdc66745d783eaf3e0bb03653892b421
4
+ data.tar.gz: 74c7214b71a9d14616290e4126a721b0a026734a
5
5
  SHA512:
6
- metadata.gz: 3e6b33218b3dcfdf66df6d96257a9a95dd75540950cbb2db636c93f8a558c4afd24ca7b3f1c5df329bc3c75905accb3924d5febf6ad49c1144ca3cefb16fa497
7
- data.tar.gz: 46bf3af116a0483d330b04dc0d5cd8f837dba90e14b8128f9d406f37b42eae517a51da4dd7d74911de0b7c1ebfd2dca771d400b53f997b87d3814ab0d7038fae
6
+ metadata.gz: 71780740178980f74a8ea65be8767e4ce35c3a6158f5c27bff47e1f7bf93a39775914348cb57d84f0f4035190f53a220e362ee020c40e1cd5f73190d85503eeb
7
+ data.tar.gz: 76f120cbca0b71028519ccbb20aeb32eb50e707c8f82ac707d272be5ac3593005bd295cb675c25f28e2c910d5a95bdcd51bdd63a2861e66c633f259a62ca0ede
@@ -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
@@ -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
@@ -1,5 +1,5 @@
1
1
  module SPF
2
2
  module Query
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
@@ -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 SPF type record over other TXT records" do
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.3
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-10-19 00:00:00.000000000 Z
11
+ date: 2015-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet