Skip to content
Open
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
2 changes: 1 addition & 1 deletion lib/MySQL_Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static int wait_for_mysql(MYSQL *mysql, int status) {
}

static void close_mysql(MYSQL *my) {
if (my->net.pvio) {
if (my->net.pvio && !my->options.use_ssl) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change correctly avoids sending an unencrypted COM_QUIT packet over an SSL connection. To make this more robust, you could also check if compression is enabled, as sending an uncompressed packet on a compressed connection would also be incorrect. This would be consistent with a similar FIXME comment in lib/mysql_connection.cpp.

	if (my->net.pvio && !my->options.use_ssl && !my->options.compress) {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the comment that it does not work with compression this change would be fine but, since I have not tested it, I did not want to introduce it. If you can check it and it solves this issue, I see no problem in extending the patch.

char buff[5];
mysql_hdr myhdr;
myhdr.pkt_id=0;
Expand Down
2 changes: 1 addition & 1 deletion lib/mysql_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2958,7 +2958,7 @@ void MySQL_Connection::optimize() {
// if avoids that a QUIT command stops forever
// FIXME: currently doesn't support encryption and compression
void MySQL_Connection::close_mysql() {
if ((send_quit) && (mysql->net.pvio) && ret_mysql) {
if ((send_quit) && (mysql->net.pvio) && ret_mysql && !mysql->options.use_ssl) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change correctly avoids sending an unencrypted COM_QUIT packet over an SSL connection, which addresses part of the FIXME on line 2959. To further address the FIXME, you could also add a check to prevent sending an uncompressed packet when compression is enabled.

	if ((send_quit) && (mysql->net.pvio) && ret_mysql && !mysql->options.use_ssl && !mysql->options.compress) {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the comment that it does not work with compression this change would be fine but, since I have not tested it, I did not want to introduce it. If you can check it and it solves this issue, I see no problem in extending the patch.

char buff[5];
mysql_hdr myhdr;
myhdr.pkt_id=0;
Expand Down