Skip to content

Commit 6624e8f

Browse files
committed
Merge pull request #373 from maginatics/remove_ssl_ca_key_check
Remove the check for SSL CA or Key being set.
2 parents d79e804 + 158954c commit 6624e8f

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

ext/mysql2/client.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,14 +1051,12 @@ static VALUE set_charset_name(VALUE self, VALUE value) {
10511051
static VALUE set_ssl_options(VALUE self, VALUE key, VALUE cert, VALUE ca, VALUE capath, VALUE cipher) {
10521052
GET_CLIENT(self);
10531053

1054-
if(!NIL_P(ca) || !NIL_P(key)) {
1055-
mysql_ssl_set(wrapper->client,
1056-
NIL_P(key) ? NULL : StringValuePtr(key),
1057-
NIL_P(cert) ? NULL : StringValuePtr(cert),
1058-
NIL_P(ca) ? NULL : StringValuePtr(ca),
1059-
NIL_P(capath) ? NULL : StringValuePtr(capath),
1060-
NIL_P(cipher) ? NULL : StringValuePtr(cipher));
1061-
}
1054+
mysql_ssl_set(wrapper->client,
1055+
NIL_P(key) ? NULL : StringValuePtr(key),
1056+
NIL_P(cert) ? NULL : StringValuePtr(cert),
1057+
NIL_P(ca) ? NULL : StringValuePtr(ca),
1058+
NIL_P(capath) ? NULL : StringValuePtr(capath),
1059+
NIL_P(cipher) ? NULL : StringValuePtr(cipher));
10621060

10631061
return self;
10641062
}

lib/mysql2/client.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def initialize(opts = {})
3636
# force the encoding to utf8
3737
self.charset_name = opts[:encoding] || 'utf8'
3838

39-
ssl_set(*opts.values_at(:sslkey, :sslcert, :sslca, :sslcapath, :sslcipher))
39+
ssl_options = opts.values_at(:sslkey, :sslcert, :sslca, :sslcapath, :sslcipher)
40+
ssl_set(*ssl_options) if ssl_options.any?
4041

4142
if [:user,:pass,:hostname,:dbname,:db,:sock].any?{|k| @query_options.has_key?(k) }
4243
warn "============= WARNING FROM mysql2 ============="

0 commit comments

Comments
 (0)