lib/sqreen/actions.rb in sqreen-1.15.1 vs lib/sqreen/actions.rb in sqreen-1.15.2
- old
+ new
@@ -169,10 +169,11 @@
end
def matching_actions(client_ip)
parsed_ip = IPAddr.new(client_ip)
trie = parsed_ip.family == Socket::AF_INET6 ? @trie_v6 : @trie_v4
+ return [] unless trie
found = trie.search_matching(parsed_ip.to_i, parsed_ip.family)
return [] unless found.size > 0
Sqreen.log.debug("Client ip #{client_ip} matches #{found.inspect}")
found.map(&:data)
@@ -269,9 +270,10 @@
class BlockUser < Base
self.type_name = 'block_user'
class << self
def actions_matching(identity_params)
+ return [] unless @idx
key = stringify_keys(identity_params)
actions = @idx[key]
actions || []
end