Forum: Ruby Sequel mysql/SSL patch

Posted by Jim Hranicky (Guest)
on 2013-03-02 02:47
(Received via mailing list)
Very quick and dirty patch to enable SSL connections
with mysql when only the cipher is specified. Verified
to work using tcpdump.

I'd do the same for mysql2, but there's more going on
there under the hood it seems, but it'd be nice to have
the same functionality in both.

Jim Hranicky
IT Security Engineer
UF Information Technology
Office of Information Security and Compliance

--
diff -ur sequel-3.45.0.orig/lib/sequel/adapters/mysql.rb 
sequel-3.45.0/lib/sequel/adapters/mysql.rb
--- sequel-3.45.0.orig/lib/sequel/adapters/mysql.rb  2013-03-01 
20:24:52.000000000 -0500
+++ sequel-3.45.0/lib/sequel/adapters/mysql.rb  2013-03-01 
20:31:27.148441555 -0500
@@ -92,7 +92,7 @@
         conn = Mysql.init
         conn.options(Mysql::READ_DEFAULT_GROUP, 
opts[:config_default_group] || "client")
         conn.options(Mysql::OPT_LOCAL_INFILE, 
opts[:config_local_infile]) if opts.has_key?(:config_local_infile)
-        conn.ssl_set(opts[:sslkey], opts[:sslcert], opts[:sslca], 
opts[:sslcapath], opts[:sslcipher]) if opts[:sslca] || opts[:sslkey]
+        conn.ssl_set(opts[:sslkey], opts[:sslcert], opts[:sslca], 
opts[:sslcapath], opts[:sslcipher]) if opts[:sslca] || opts[:sslkey] || 
opts[:sslcipher]
         if encoding = opts[:encoding] || opts[:charset]
           # Set encoding before connecting so that the mysql driver 
knows what
           # encoding we want to use, but this can be overridden by 
READ_DEFAULT_GROUP.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.