diff options
author | Micah Wedemeyer <mwedemeyer@micah.(none)> | 2008-07-11 23:50:55 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-07-11 23:52:41 +0100 |
commit | 5e2e1ed9ffc481a91596d8c3fd9a68d7977e75ca (patch) | |
tree | e47b8f9692a8ad4bc7da74d21943bc076184bc7d /activerecord/lib | |
parent | 6ebdd0e32b846e99a9885b06fbca2bed58149c7e (diff) | |
download | rails-5e2e1ed9ffc481a91596d8c3fd9a68d7977e75ca.tar.gz rails-5e2e1ed9ffc481a91596d8c3fd9a68d7977e75ca.tar.bz2 rails-5e2e1ed9ffc481a91596d8c3fd9a68d7977e75ca.zip |
Ensure MysqlAdapter allows SSL connection when only sslca is supplied. [#253 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index c5962764f5..4b13ac8be0 100755 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -69,7 +69,7 @@ module ActiveRecord MysqlCompat.define_all_hashes_method! mysql = Mysql.init - mysql.ssl_set(config[:sslkey], config[:sslcert], config[:sslca], config[:sslcapath], config[:sslcipher]) if config[:sslkey] + mysql.ssl_set(config[:sslkey], config[:sslcert], config[:sslca], config[:sslcapath], config[:sslcipher]) if config[:sslca] || config[:sslkey] ConnectionAdapters::MysqlAdapter.new(mysql, logger, [host, username, password, database, port, socket], config) end @@ -145,6 +145,7 @@ module ActiveRecord # * <tt>:password</tt> - Defaults to nothing. # * <tt>:database</tt> - The name of the database. No default, must be provided. # * <tt>:encoding</tt> - (Optional) Sets the client encoding by executing "SET NAMES <encoding>" after connection. + # * <tt>:sslca</tt> - Necessary to use MySQL with an SSL connection. # * <tt>:sslkey</tt> - Necessary to use MySQL with an SSL connection. # * <tt>:sslcert</tt> - Necessary to use MySQL with an SSL connection. # * <tt>:sslcapath</tt> - Necessary to use MySQL with an SSL connection. @@ -507,7 +508,9 @@ module ActiveRecord @connection.options(Mysql::SET_CHARSET_NAME, encoding) rescue nil end - @connection.ssl_set(@config[:sslkey], @config[:sslcert], @config[:sslca], @config[:sslcapath], @config[:sslcipher]) if @config[:sslkey] + if @config[:sslca] || @config[:sslkey] + @connection.ssl_set(@config[:sslkey], @config[:sslcert], @config[:sslca], @config[:sslcapath], @config[:sslcipher]) + end @connection.real_connect(*@connection_options) |