Commit eb30bb85 authored by Sergei Golubchik's avatar Sergei Golubchik

bugfix: change_user should only take the password

of the previous user if it takes the username too.
otherwise it can never change to a passwordless account
parent ddfcec2c
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "client_priv.h" #include "client_priv.h"
#include <mysql_version.h> #include <mysql_version.h>
#include <mysqld_error.h> #include <mysqld_error.h>
#include <sql_common.h>
#include <m_ctype.h> #include <m_ctype.h>
#include <my_dir.h> #include <my_dir.h>
#include <hash.h> #include <hash.h>
...@@ -3610,13 +3611,15 @@ void do_change_user(struct st_command *command) ...@@ -3610,13 +3611,15 @@ void do_change_user(struct st_command *command)
} }
if (!ds_user.length) if (!ds_user.length)
{
dynstr_set(&ds_user, mysql->user); dynstr_set(&ds_user, mysql->user);
if (!ds_passwd.length) if (!ds_passwd.length)
dynstr_set(&ds_passwd, mysql->passwd); dynstr_set(&ds_passwd, mysql->passwd);
if (!ds_db.length) if (!ds_db.length)
dynstr_set(&ds_db, mysql->db); dynstr_set(&ds_db, mysql->db);
}
DBUG_PRINT("info",("connection: '%s' user: '%s' password: '%s' database: '%s'", DBUG_PRINT("info",("connection: '%s' user: '%s' password: '%s' database: '%s'",
cur_con->name, ds_user.str, ds_passwd.str, ds_db.str)); cur_con->name, ds_user.str, ds_passwd.str, ds_db.str));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment