Skip to content

Commit

Permalink
MDEV-7656 init_file option does not allow changing passwords
Browse files Browse the repository at this point in the history
allow SET PASSWORD from  bootstrap and init-file
  • Loading branch information
vuvova committed Oct 22, 2015
1 parent e257b8b commit 3e1c743
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
8 changes: 8 additions & 0 deletions mysql-test/r/init_file_set_password-7656.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
create user foo@localhost;
select user,host,password from mysql.user where user='foo';
user host password
foo localhost
select user,host,password from mysql.user where user='foo';
user host password
foo localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
drop user foo@localhost;
26 changes: 26 additions & 0 deletions mysql-test/t/init_file_set_password-7656.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# MDEV-7656 init_file option does not allow changing passwords
#
--source include/not_embedded.inc

create user foo@localhost;

select user,host,password from mysql.user where user='foo';

--write_file $MYSQLTEST_VARDIR/init.file
grant all on *.* to foo@localhost identified by 'test';
EOF

--enable_reconnect

--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

--shutdown_server 10
--source include/wait_until_disconnected.inc

--exec echo "restart:--init-file=$MYSQLTEST_VARDIR/init.file " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

--source include/wait_until_connected_again.inc
select user,host,password from mysql.user where user='foo';

drop user foo@localhost;
3 changes: 2 additions & 1 deletion sql/sql_acl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2558,7 +2558,8 @@ int check_change_password(THD *thd, const char *host, const char *user,
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
return(1);
}
if (!thd->slave_thread && !thd->security_ctx->priv_user[0])
if (!thd->slave_thread && !thd->security_ctx->priv_user[0] &&
!in_bootstrap)
{
my_message(ER_PASSWORD_ANONYMOUS_USER, ER(ER_PASSWORD_ANONYMOUS_USER),
MYF(0));
Expand Down

0 comments on commit 3e1c743

Please sign in to comment.