From 6a4517f910eb4ae61c563933dcaf6c7db5c2b172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Fri, 21 Oct 2016 23:17:02 +0000 Subject: [PATCH] Kill threads uses wrong credentials This is a regression bug introduced by hashed passwords --- lib/MySQL_Session.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 6ba3e4e63..c40f71c5d 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -736,7 +736,15 @@ void MySQL_Session::handler_again___new_thread_to_kill_connection() { myds->killed_at=thread->curtime; //fprintf(stderr,"Expired: %llu, %llu\n", mybe->server_myds->wait_until, thread->curtime); MySQL_Connection_userinfo *ui=client_myds->myconn->userinfo; - KillArgs *ka = new KillArgs(ui->username, ui->password, myds->myconn->parent->address, myds->myconn->parent->port, myds->myconn->mysql->thread_id); + char *auth_password=NULL; + if (ui->password) { + if (ui->password[0]=='*') { // we don't have the real password, let's pass sha1 + auth_password=ui->sha1_pass; + } else { + auth_password=ui->password; + } + } + KillArgs *ka = new KillArgs(ui->username, auth_password, myds->myconn->parent->address, myds->myconn->parent->port, myds->myconn->mysql->thread_id); pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);