Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL 5.6.36 and above also has full SSL support #1304

Merged
merged 2 commits into from
Jan 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ext/mysql2/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ struct nogvl_select_db_args {
static VALUE rb_set_ssl_mode_option(VALUE self, VALUE setting) {
unsigned long version = mysql_get_client_version();

if (version < 50703) {
rb_warn( "Your mysql client library does not support setting ssl_mode; full support comes with 5.7.11." );
if (version < 50630 || (version >= 50700 && version < 50703)) {
rb_warn( "Your mysql client library does not support setting ssl_mode; full support comes with 5.6.36+, 5.7.11+, 8.0+" );
return Qnil;
}
#if defined(HAVE_CONST_MYSQL_OPT_SSL_VERIFY_SERVER_CERT) || defined(HAVE_CONST_MYSQL_OPT_SSL_ENFORCE)
Expand Down Expand Up @@ -1723,7 +1723,7 @@ void init_mysql2_client() {
rb_const_set(cMysql2Client, rb_intern("SESSION_TRACK_TRANSACTION_STATE"), INT2NUM(SESSION_TRACK_TRANSACTION_STATE));
#endif

#if defined(FULL_SSL_MODE_SUPPORT) // MySQL 5.7.11 and above
#if defined(FULL_SSL_MODE_SUPPORT) // MySQL 5.6.36 and MySQL 5.7.11 and above
rb_const_set(cMysql2Client, rb_intern("SSL_MODE_DISABLED"), INT2NUM(SSL_MODE_DISABLED));
rb_const_set(cMysql2Client, rb_intern("SSL_MODE_PREFERRED"), INT2NUM(SSL_MODE_PREFERRED));
rb_const_set(cMysql2Client, rb_intern("SSL_MODE_REQUIRED"), INT2NUM(SSL_MODE_REQUIRED));
Expand Down
2 changes: 2 additions & 0 deletions ext/mysql2/result.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ static size_t rb_mysql_result_memsize(const void * wrapper) {
return memsize;
}

#ifdef HAVE_RB_GC_MARK_MOVABLE
static void rb_mysql_result_compact(void * wrapper) {
mysql2_result_wrapper * w = wrapper;
if (w) {
Expand All @@ -153,6 +154,7 @@ static void rb_mysql_result_compact(void * wrapper) {
rb_mysql2_gc_location(w->statement);
}
}
#endif

static const rb_data_type_t rb_mysql_result_type = {
"rb_mysql_result",
Expand Down
2 changes: 2 additions & 0 deletions ext/mysql2/statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ static size_t rb_mysql_stmt_memsize(const void * ptr) {
return sizeof(*stmt_wrapper);
}

#ifdef HAVE_RB_GC_MARK_MOVABLE
static void rb_mysql_stmt_compact(void * ptr) {
mysql_stmt_wrapper *stmt_wrapper = ptr;
if (!stmt_wrapper) return;

rb_mysql2_gc_location(stmt_wrapper->client);
}
#endif

static const rb_data_type_t rb_mysql_statement_type = {
"rb_mysql_statement",
Expand Down