Skip to content

Commit 03f7854

Browse files
committed
mysql: handle SSL indication for MySQL>=8.0
1 parent 1af307e commit 03f7854

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

modules/db_mysql/my_con.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,12 @@ int db_mysql_connect(struct my_con* ptr)
144144
(tls_opts & MY_CON_TLS_CA_DIR) ? ptr->tls_dom->ca_directory:NULL,
145145
(tls_opts & MY_CON_TLS_CIPHERS) ? ptr->tls_dom->ciphers_list:NULL);
146146
}
147+
#ifdef LIBMARIADB
147148
mysql_options(ptr->con, MYSQL_OPT_SSL_ENFORCE, (void *)&use_tls);
149+
#else
150+
tls_opts = (use_tls?SSL_MODE_PREFERRED:SSL_MODE_DISABLED);
151+
mysql_options(ptr->con, MYSQL_OPT_SSL_MODE, (void *)&tls_opts);
152+
#endif
148153

149154
/* set connect, read and write timeout, the value counts three times */
150155
mysql_options(ptr->con, MYSQL_OPT_CONNECT_TIMEOUT, (void *)&db_mysql_timeout_interval);

0 commit comments

Comments
 (0)