Skip to content

Commit b1c41e1

Browse files
committed
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.
1 parent a80f5fd commit b1c41e1

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

mysql-test/main/grant.result

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,3 +2762,11 @@ DROP USER dummy@localhost;
27622762
#
27632763
# End of 10.2 tests
27642764
#
2765+
#
2766+
# MDEV-17932 : Assertion upon double RENAME USER
2767+
#
2768+
CREATE USER foo@localhost;
2769+
CREATE USER bar2@localhost;
2770+
RENAME USER foo@localhost TO bar1@localhost, bar1@localhost TO bar3@localhost;
2771+
DROP USER bar2@localhost;
2772+
DROP USER bar3@localhost;

mysql-test/main/grant.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,3 +2258,12 @@ DROP USER dummy@localhost;
22582258
--echo #
22592259
--echo # End of 10.2 tests
22602260
--echo #
2261+
2262+
--echo #
2263+
--echo # MDEV-17932 : Assertion upon double RENAME USER
2264+
--echo #
2265+
CREATE USER foo@localhost;
2266+
CREATE USER bar2@localhost;
2267+
RENAME USER foo@localhost TO bar1@localhost, bar1@localhost TO bar3@localhost;
2268+
DROP USER bar2@localhost;
2269+
DROP USER bar3@localhost;

sql/sql_acl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10365,9 +10365,9 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
1036510365
continue;
1036610366
}
1036710367
some_users_renamed= TRUE;
10368+
rebuild_acl_users();
1036810369
}
1036910370

10370-
rebuild_acl_users();
1037110371

1037210372
/* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */
1037310373
rebuild_check_host();

0 commit comments

Comments
 (0)