Skip to content

Commit

Permalink
ssl_params: use NULL instead of empty string #4466
Browse files Browse the repository at this point in the history
If values in mysql_servers_ssl_params are empty strings, they needs
to be passed as NULL arguments in mysql_ssl_set() and mysql_options()

Closes #4466
  • Loading branch information
renecannao committed Mar 8, 2024
1 parent f60df66 commit 8ab51c6
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/mysql_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,14 +761,16 @@ void MySQL_Connection::connect_start() {
mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, mysql_thread___ssl_p2s_crlpath);
} else {
mysql_ssl_set(mysql,
ssl_params->ssl_key.c_str(),
ssl_params->ssl_cert.c_str(),
ssl_params->ssl_ca.c_str(),
ssl_params->ssl_capath.c_str(),
ssl_params->ssl_cipher.c_str()
( ssl_params->ssl_key.length() > 0 ? ssl_params->ssl_key.c_str() : NULL ) ,
( ssl_params->ssl_cert.length() > 0 ? ssl_params->ssl_cert.c_str() : NULL ) ,
( ssl_params->ssl_ca.length() > 0 ? ssl_params->ssl_ca.c_str() : NULL ) ,
( ssl_params->ssl_capath.length() > 0 ? ssl_params->ssl_capath.c_str() : NULL ) ,
( ssl_params->ssl_cipher.length() > 0 ? ssl_params->ssl_cipher.c_str() : NULL )
);
mysql_options(mysql, MYSQL_OPT_SSL_CRL, ssl_params->ssl_crl.c_str());
mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, ssl_params->ssl_crlpath.c_str());
mysql_options(mysql, MYSQL_OPT_SSL_CRL,
( ssl_params->ssl_crl.length() > 0 ? ssl_params->ssl_crl.c_str() : NULL ) );
mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH,
( ssl_params->ssl_crlpath.length() > 0 ? ssl_params->ssl_crlpath.c_str() : NULL ) );
}
mysql_options(mysql, MARIADB_OPT_SSL_KEYLOG_CALLBACK, (void*)proxysql_keylog_write_line_callback);
}
Expand Down

0 comments on commit 8ab51c6

Please sign in to comment.