1
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:
HD Moore 2006-12-10 08:27:51 +00:00
parent 40242aca92
commit d39d662c95

View File

@ -63,6 +63,12 @@ class Plugin::DBMySQL < Msf::Plugin
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