spf 0.0.53 → 0.0.54

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
- SHA256:
3
- metadata.gz: 9b5b96521a48a4f0b0a78397d6e21ff99d03b9d144df182bfd68b0369046d73e
4
- data.tar.gz: 17025632b91737a607a5035b9dfd2405bb080eeaee3e8091cd5e71dc4729cd4d
2
+ SHA1:
3
+ metadata.gz: 8e8afc8e375d137af56775cbd41cfd3d3105cf45
4
+ data.tar.gz: 75a7ca24ee85ebf0a4e1986a0b5af7c4ee263bde
5
5
  SHA512:
6
- metadata.gz: aea5c665821e18e2724d0d0e92ca02a89347eabc53226135944b9de65b7b20d25f64401128606f49367a718e637b2d425fa6bb2fdb0999b3cbecae72c5698852
7
- data.tar.gz: f4f74a840d9fbe744d5b2fbf52abb5011f5c75672b648e6d0512450d7261997ee4006a83f707ec50300639972a235b0d261e11ac976bddf5a2eea13db8944150
6
+ metadata.gz: 1d67198fa465bafabb7e1de1d929c75d92ae12f422c815762456758cbea43f99f40c903c4b07c25109a21c7f0247f6a9a8dce4e9b2e75829b92dfdc58bb42fdd
7
+ data.tar.gz: 8e1d403dd518403d70bed335c2c19fb03bb026d226db073b095b54dc0fe90aa26c2705426a646ad14d7603ef5877ff940068dfd845b4100ab71e6ea7ac53cd82
data/Gemfile.lock CHANGED
@@ -45,7 +45,7 @@ GEM
45
45
  multi_json (~> 1.3)
46
46
  multi_xml (~> 0.5)
47
47
  rack (>= 1.2, < 3)
48
- psych (3.2.0)
48
+ psych (3.1.0)
49
49
  rack (2.2.3)
50
50
  rake (13.0.1)
51
51
  rchardet (1.8.0)
data/lib/spf/eval.rb CHANGED
@@ -188,75 +188,62 @@ class SPF::Server
188
188
  query_count = 0
189
189
  dns_errors = []
190
190
 
191
- # Query for SPF-type RRs first:
192
- if (@query_rr_types == QUERY_RR_TYPE_ALL or
193
- @query_rr_types & QUERY_RR_TYPE_SPF)
191
+ # Query for TXT-type RRs first:
192
+ if @query_rr_types != QUERY_RR_TYPE_SPF
194
193
  begin
195
194
  query_count += 1
196
- packet = self.dns_lookup(domain, 'SPF')
195
+ packet = self.dns_lookup(domain, 'TXT')
197
196
  matches = self.get_acceptable_records_from_packet(
198
- packet, 'SPF', versions, scope, domain, loose_match)
197
+ packet, 'TXT', versions, scope, domain, loose_match)
199
198
  records << matches[0]
200
199
  loose_records << matches[1]
201
200
  rescue SPF::DNSError => e
202
201
  dns_errors << e
203
- #rescue SPF::DNSTimeout => e
204
- # # FIXME: Ignore DNS timeouts on SPF type lookups?
205
- # # Apparently some brain-dead DNS servers time out on SPF-type queries.
206
202
  end
207
203
  end
208
204
 
209
- if (not records.flatten.any? and
210
- @query_rr_types == QUERY_RR_TYPE_ALL or
211
- @query_rr_types & QUERY_RR_TYPE_TXT)
212
- # NOTE:
213
- # This deliberately violates RFC 4406 (Sender ID), 4.4/3 (4.4.1):
214
- # TXT-type RRs are still tried if there _are_ SPF-type RRs but all
215
- # of them are inapplicable (e.g. "Hi!", or even "spf2/pra" for an
216
- # 'mfrom' scope request). This conforms to the spirit of the more
217
- # sensible algorithm in RFC 4408 (SPF), 4.5.
218
- # Implication: Sender ID processing may make use of existing TXT-
219
- # type records where a result of "None" would normally be returned
220
- # under a strict interpretation of RFC 4406.
221
-
205
+ if records.flatten.empty? && @query_rr_types != QUERY_RR_TYPE_TXT
222
206
  begin
223
207
  query_count += 1
224
- packet = self.dns_lookup(domain, 'TXT')
208
+ packet = self.dns_lookup(domain, 'SPF')
225
209
  matches = self.get_acceptable_records_from_packet(
226
- packet, 'TXT', versions, scope, domain, loose_match)
210
+ packet, 'SPF', versions, scope, domain, loose_match)
227
211
  records << matches[0]
228
212
  loose_records << matches[1]
229
213
  rescue SPF::DNSError => e
230
214
  dns_errors << e
215
+ #rescue SPF::DNSTimeout => e
216
+ # # FIXME: Ignore DNS timeouts on SPF type lookups?
217
+ # # Apparently some brain-dead DNS servers time out on SPF-type queries.
231
218
  end
219
+ end
232
220
 
233
- # Unless at least one query succeeded, re-raise the first DNS error that occured.
234
- raise dns_errors[0] unless dns_errors.length < query_count
235
-
236
- records.flatten!
237
- loose_records.flatten!
221
+ # Unless at least one query succeeded, re-raise the first DNS error that occured.
222
+ raise dns_errors[0] unless dns_errors.length < query_count
238
223
 
239
- if records.empty?
240
- # RFC 4408, 4.5/7
241
- raise SPF::NoAcceptableRecordError.new('No applicable sender policy available',
242
- loose_records)
243
- end
224
+ records.flatten!
225
+ loose_records.flatten!
244
226
 
245
- # Discard all records but the highest acceptable version:
246
- preferred_record_class = records[0].class
227
+ if records.empty?
228
+ # RFC 4408, 4.5/7
229
+ raise SPF::NoAcceptableRecordError.new('No applicable sender policy available',
230
+ loose_records)
231
+ end
247
232
 
248
- records = records.select { |record| preferred_record_class === record }
233
+ # Discard all records but the highest acceptable version:
234
+ preferred_record_class = records[0].class
249
235
 
250
- if records.length != 1
251
- # RFC 4408, 4.5/6
252
- raise SPF::RedundantAcceptableRecordsError.new(
253
- "Redundant applicable '#{preferred_record_class.version_tag}' sender policies found",
254
- records
255
- )
256
- end
236
+ records = records.select { |record| preferred_record_class === record }
257
237
 
258
- return records[0]
238
+ if records.length != 1
239
+ # RFC 4408, 4.5/6
240
+ raise SPF::RedundantAcceptableRecordsError.new(
241
+ "Redundant applicable '#{preferred_record_class.version_tag}' sender policies found",
242
+ records
243
+ )
259
244
  end
245
+
246
+ return records[0]
260
247
  end
261
248
 
262
249
  def get_acceptable_records_from_packet(packet, rr_type, versions, scope, domain, loose_match)
data/lib/spf/model.rb CHANGED
@@ -995,7 +995,7 @@ class SPF::Record
995
995
  if mech.match(server, request, request.ip_address != nil)
996
996
  result_name = RESULTS_BY_QUALIFIER[mech.qualifier]
997
997
  result_class = server.result_class(result_name)
998
- result = result_class.new([server, request, "Mechanism '#{term}' matched"])
998
+ result = result_class.new([server, request, "Mechanism '#{term.text}' matched"])
999
999
  mech.explain(server, request, result)
1000
1000
  raise result if want_result
1001
1001
  end
data/lib/spf/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: ASCII-8BIT
2
2
  module SPF
3
- VERSION = '0.0.53'
3
+ VERSION = '0.0.54'
4
4
  end
5
5
 
6
6
  # vim:sw=2 sts=2
data/spf.gemspec CHANGED
@@ -3,10 +3,12 @@
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
  # stub: spf 0.0.48 ruby lib
6
+ $:.unshift File.expand_path("../lib", __FILE__)
7
+ require 'spf/version'
6
8
 
7
9
  Gem::Specification.new do |s|
8
10
  s.name = "spf"
9
- s.version = "0.0.53"
11
+ s.version = SPF::VERSION
10
12
 
11
13
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
14
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.53
4
+ version: 0.0.54
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Flury
8
8
  - Julian Mehnle
9
9
  - Jacob Rideout
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
  date: 2015-04-29 00:00:00.000000000 Z
@@ -118,7 +118,7 @@ homepage: https://github.com/agaridata/spf-ruby
118
118
  licenses:
119
119
  - none (all rights reserved)
120
120
  metadata: {}
121
- post_install_message:
121
+ post_install_message:
122
122
  rdoc_options: []
123
123
  require_paths:
124
124
  - lib
@@ -133,8 +133,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  requirements: []
136
- rubygems_version: 3.0.6
137
- signing_key:
136
+ rubyforge_project:
137
+ rubygems_version: 2.5.1
138
+ signing_key:
138
139
  specification_version: 4
139
140
  summary: Implementation of the Sender Policy Framework
140
141
  test_files: []