spf 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/spf/model.rb +9 -11
- data/lib/spf/version.rb +1 -1
- data/spf.gemspec +1 -1
- metadata +1 -4
data/lib/spf/model.rb
CHANGED
@@ -302,21 +302,18 @@ class SPF::Mech < SPF::Term
|
|
302
302
|
|
303
303
|
ipv4_prefix_length = @ipv4_prefix_length
|
304
304
|
ipv6_prefix_length = @ipv6_prefix_length
|
305
|
-
|
306
|
-
|
307
|
-
server.count_void_dns_lookup(request) unless (rrs = packet.answer)
|
305
|
+
packet = server.dns_lookup(domain, 'ANY')
|
306
|
+
server.count_void_dns_lookup(request) unless (rrs = packet)
|
308
307
|
|
309
308
|
rrs.each do |rr|
|
310
|
-
if
|
309
|
+
if Resolv::DNS::Resource::IN::A === rr
|
311
310
|
network = IP.new("#{rr.address}/#{ipv4_prefix_length}")
|
312
311
|
@ip_netblocks << network
|
313
312
|
return true if network.contains?(request.ip_address)
|
314
|
-
elsif
|
313
|
+
elsif Resolv::DNS::Resource::IN::AAAA === rr
|
315
314
|
network = IP.new("#{rr.address}/#{ipv6_prefix_length}")
|
316
315
|
@ip_netblocks << network
|
317
316
|
return true if network.contains?(request.ip_address_v6)
|
318
|
-
elsif rr.type == 'CNAME'
|
319
|
-
# Ignore -- we should have gotten the A/AAAA records anyway.
|
320
317
|
else
|
321
318
|
# Unexpected RR type.
|
322
319
|
# TODO: Generate debug info or ignore silently.
|
@@ -358,13 +355,13 @@ class SPF::Mech < SPF::Term
|
|
358
355
|
def params
|
359
356
|
params = ''
|
360
357
|
if @domain_spec
|
361
|
-
params += ':' + @domain_spec if @domain_spec
|
358
|
+
params += ':' + @domain_spec.to_s if @domain_spec
|
362
359
|
end
|
363
360
|
if @ipv4_prefix_length and @ipv4_prefix_length != self.default_ipv4_prefix_length
|
364
|
-
params += '/' + @ipv4_prefix_length
|
361
|
+
params += '/' + @ipv4_prefix_length.to_s
|
365
362
|
end
|
366
363
|
if @ipv6_prefix_length and @ipv6_prefix_length != DEFAULT_IPV6_PREFIX_LENGTH
|
367
|
-
params += '//' + @ipv6_prefix_length
|
364
|
+
params += '//' + @ipv6_prefix_length.to_s
|
368
365
|
end
|
369
366
|
return params
|
370
367
|
end
|
@@ -791,6 +788,7 @@ class SPF::Record
|
|
791
788
|
|
792
789
|
def ip_netblocks
|
793
790
|
@ip_netblocks.flatten!
|
791
|
+
return @ip_netblocks
|
794
792
|
end
|
795
793
|
|
796
794
|
def parse
|
@@ -857,7 +855,7 @@ class SPF::Record
|
|
857
855
|
# Looks like a modifier:
|
858
856
|
mod_text = $1
|
859
857
|
mod_name = $2.downcase
|
860
|
-
mod_class = MOD_CLASSES[mod_name]
|
858
|
+
mod_class = self.class::MOD_CLASSES[mod_name]
|
861
859
|
if mod_class
|
862
860
|
# Known modifier.
|
863
861
|
term = mod = mod_class.new_from_string(mod_text)
|
data/lib/spf/version.rb
CHANGED
data/spf.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -119,9 +119,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
119
|
- - ! '>='
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
|
-
segments:
|
123
|
-
- 0
|
124
|
-
hash: 3002258988282268889
|
125
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
123
|
none: false
|
127
124
|
requirements:
|