MDEV-17932 : assertion in multi RENAME USER command.

Sort acl_users inside the mysql_rename_user()'s loop, after every
successful iteration.

This is needed because on the next loop's iteration find_user_exact()
is used, which requires correct sorting by name.
This commit is contained in:
Vladislav Vaintroub 2018-12-08 01:16:05 +01:00
parent a80f5fdbd1
commit b1c41e112c
3 changed files with 18 additions and 1 deletions

View File

@ -2762,3 +2762,11 @@ DROP USER dummy@localhost;
#
# End of 10.2 tests
#
#
# MDEV-17932 : Assertion upon double RENAME USER
#
CREATE USER foo@localhost;
CREATE USER bar2@localhost;
RENAME USER foo@localhost TO bar1@localhost, bar1@localhost TO bar3@localhost;
DROP USER bar2@localhost;
DROP USER bar3@localhost;

View File

@ -2258,3 +2258,12 @@ DROP USER dummy@localhost;
--echo #
--echo # End of 10.2 tests
--echo #
--echo #
--echo # MDEV-17932 : Assertion upon double RENAME USER
--echo #
CREATE USER foo@localhost;
CREATE USER bar2@localhost;
RENAME USER foo@localhost TO bar1@localhost, bar1@localhost TO bar3@localhost;
DROP USER bar2@localhost;
DROP USER bar3@localhost;

View File

@ -10365,9 +10365,9 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
continue;
}
some_users_renamed= TRUE;
rebuild_acl_users();
}
rebuild_acl_users();
/* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */
rebuild_check_host();