Merge branch 'jlee-r7-bug/redmine-7226-rhost-dns'

unstable
sinn3r 2012-09-13 11:04:51 -05:00
commit c6c59b6df6
1 changed files with 13 additions and 5 deletions

View File

@ -253,7 +253,7 @@ class DBManager
wspace = find_workspace(wspace) wspace = find_workspace(wspace)
end end
address, scope = address.split('%', 2) address = normalize_host(address)
return wspace.hosts.find_by_address(address) return wspace.hosts.find_by_address(address)
} }
end end
@ -6066,11 +6066,19 @@ class DBManager
if (host.kind_of? String) if (host.kind_of? String)
# If it's an IPv4 addr with a port on the end, strip the port if Rex::Socket.is_ipv4?(host)
if Rex::Socket.is_ipv4?(host) and host =~ /((\d{1,3}\.){3}\d{1,3}):\d+/ # If it's an IPv4 addr with a port on the end, strip the port
norm_host = $1 if host =~ /((\d{1,3}\.){3}\d{1,3}):\d+/
norm_host = $1
else
norm_host = host
end
elsif Rex::Socket.is_ipv6?(host)
# If it's an IPv6 addr, drop the scope
address, scope = host.split('%', 2)
norm_host = address
else else
norm_host = host norm_host = Rex::Socket.getaddress(host, true)
end end
elsif host.kind_of? ::Mdm::Session elsif host.kind_of? ::Mdm::Session
norm_host = host.host norm_host = host.host