lib/spf/model.rb in spf-0.0.21 vs lib/spf/model.rb in spf-0.0.22

- old
+ new

@@ -384,11 +384,11 @@ return params end def match(server, request, want_result = true) server.count_dns_interactive_term(request) - return self.match_in_domain(server, request) + return self.match_in_domain(server, request, request.domain) end end class SPF::Mech::All < SPF::Mech @@ -438,11 +438,16 @@ NAME = 'ip4' def parse_params(required = true) self.parse_ipv4_network(required) - @ip_netblocks << @ip_network if IP === @ip_network + if IP === @ip_network + @ip_netblocks << @ip_network + @errors << SPF::InvalidMechCIDRError.new( + 'Invalid CIDR netblock - bits in host portion of address' + ) if @ip_network.offset != 0 + end end def params return nil unless @ip_network return @ip_network if String === @ip_network @@ -468,10 +473,13 @@ NAME = 'ip6' def parse_params(required = true) self.parse_ipv6_network(required) @ip_netblocks << @ip_network if IP === @ip_network + @errors << SPF::InvalidMechCIDRError.new( + 'Invalid CIDR netblock - bits in host portion of address' + ) if @ip_network.offset != 0 end def params return nil unless @ip_network return @ip_network if String === @ip_network @@ -1041,9 +1049,13 @@ } VALID_SCOPE = /^(?: mfrom | pra )$/x def version_tag 'v=spf2.0' + end + + def scopes + [:mfrom, :pra] end def version_tag_pattern " spf(2\.0)