diff --git a/Gemfile.lock b/Gemfile.lock index a1d1bfda53..95e8526ac0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - metasploit-framework (4.9.2.pre.dev) + metasploit-framework (4.9.3.pre.dev) activesupport (>= 3.0.0, < 4.0.0) bcrypt json @@ -69,12 +69,12 @@ GEM activerecord (>= 3.2.13, < 4.0.0) activesupport pg - mini_portile (0.5.3) + mini_portile (0.6.0) msgpack (0.5.8) multi_json (1.0.4) network_interface (0.0.1) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) + nokogiri (1.6.2.1) + mini_portile (= 0.6.0) packetfu (1.1.9) pcaprub (0.11.3) pg (0.17.1) diff --git a/lib/msf/core/db_manager.rb b/lib/msf/core/db_manager.rb index 93e6e7ab00..bc586fae2d 100644 --- a/lib/msf/core/db_manager.rb +++ b/lib/msf/core/db_manager.rb @@ -129,7 +129,7 @@ class DBManager ActiveRecord::Base.connection_pool.with_connection { ActiveRecord::Base.connection.active? } - rescue PG::ConnectionBad => error + rescue ActiveRecord::ConnectionNotEstablished, PG::ConnectionBad => error elog("Connection not established: #{error.class} #{error}:\n#{error.backtrace.join("\n")}") false @@ -144,6 +144,8 @@ class DBManager if connection_established? && ActiveRecord::Base.connection_config[:adapter] == ADAPTER dlog("Already established connection to #{ADAPTER}, so reusing active connection.") + self.drivers << ADAPTER + self.driver = ADAPTER else begin ActiveRecord::Base.establish_connection(adapter: ADAPTER) @@ -151,7 +153,6 @@ class DBManager rescue Exception => error @adapter_error = error else - # @deprecated Use in RPC_Db, but only postgresql is supported, so useless otherwise self.drivers << ADAPTER self.driver = ADAPTER end