Commit 34c0e94e 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 9ea94ed4
......@@ -36,6 +36,7 @@
#include "client_priv.h"
#include <mysql_version.h>
#include <mysqld_error.h>
#include <sql_common.h>
#include <m_ctype.h>
#include <my_dir.h>
#include <hash.h>
......@@ -3610,13 +3611,15 @@ void do_change_user(struct st_command *command)
}
if (!ds_user.length)
{
dynstr_set(&ds_user, mysql->user);
if (!ds_passwd.length)
dynstr_set(&ds_passwd, mysql->passwd);
if (!ds_passwd.length)
dynstr_set(&ds_passwd, mysql->passwd);
if (!ds_db.length)
dynstr_set(&ds_db, mysql->db);
if (!ds_db.length)
dynstr_set(&ds_db, mysql->db);
}
DBUG_PRINT("info",("connection: '%s' user: '%s' password: '%s' database: '%s'",
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