From 8311dba654cd8d975324f929c1b542a767628c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 13 Jun 2019 16:44:26 +0300 Subject: [PATCH] Send the OK outside the KILL functions By sending the OK for the KILL commands outside the function, they can be used to kill connections that do not expect responses. --- server/modules/protocol/MySQL/mariadbclient/mysql_client.cc | 3 +++ server/modules/protocol/MySQL/mysql_common.cc | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc index a7a9c8355..3edc5e62b 100644 --- a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc +++ b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc @@ -2030,6 +2030,7 @@ static spec_com_res_t process_special_commands(DCB* dcb, GWBUF* read_buffer, int { uint64_t process_id = gw_mysql_get_byte4(bytes); mxs_mysql_execute_kill(dcb->session, process_id, KT_CONNECTION); + mxs_mysql_send_ok(dcb, 1, 0, NULL); rval = RES_END; } } @@ -2106,6 +2107,8 @@ spec_com_res_t handle_query_kill(DCB* dcb, { mxs_mysql_execute_kill_user(dcb->session, user.c_str(), kt); } + + mxs_mysql_send_ok(dcb, 1, 0, NULL); } } } diff --git a/server/modules/protocol/MySQL/mysql_common.cc b/server/modules/protocol/MySQL/mysql_common.cc index c4e146f94..bfa03c90b 100644 --- a/server/modules/protocol/MySQL/mysql_common.cc +++ b/server/modules/protocol/MySQL/mysql_common.cc @@ -1445,8 +1445,6 @@ void mxs_mysql_execute_kill(MXS_SESSION* issuer, uint64_t target_id, kill_type_t (intptr_t)worker_func, (intptr_t) new ConnKillInfo(target_id, ss.str(), issuer)); } - - mxs_mysql_send_ok(issuer->client_dcb, 1, 0, NULL); } void mxs_mysql_execute_kill_user(MXS_SESSION* issuer, const char* user, kill_type_t type) @@ -1465,8 +1463,6 @@ void mxs_mysql_execute_kill_user(MXS_SESSION* issuer, const char* user, kill_typ (intptr_t)worker_func, (intptr_t) new UserKillInfo(user, ss.str(), issuer)); } - - mxs_mysql_send_ok(issuer->client_dcb, 1, 0, NULL); } /**