mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-05 14:57:30 +01:00
Fix "localhost" bug for connect calls as well
git-svn-id: file:///home/svn/framework3/trunk@4182 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
40242aca92
commit
d39d662c95
@ -62,7 +62,13 @@ class Plugin::DBMySQL < Msf::Plugin
|
||||
opts['database'] = info[:name]
|
||||
opts['host'] = info[:host] if (info[:host])
|
||||
opts['port'] = info[:port] if (info[:port])
|
||||
|
||||
|
||||
# This is an ugly hack for a broken MySQL adapter:
|
||||
# http://dev.rubyonrails.org/ticket/3338
|
||||
if (opts['host'].strip.downcase == 'localhost')
|
||||
opts['host'] = Socket.gethostbyname("localhost")[3].unpack("C*").join(".")
|
||||
end
|
||||
|
||||
if (not framework.db.connect(opts))
|
||||
raise PluginLoadError.new("Failed to connect to the database")
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user