diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2018-12-10 17:18:17 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2018-12-10 17:23:03 +0100 |
commit | 80491609361f4fd800185f6b5cabc8ee6e319118 (patch) | |
tree | 4cbb668b3803cc6f8a05e00f3d3fbe3d77caa690 | |
parent | 34eb98387f8f46a80fb053081dbe20d415f23b39 (diff) | |
download | mariadb-git-80491609361f4fd800185f6b5cabc8ee6e319118.tar.gz |
MDEV-17946 : Unsorted acl_dbs after RENAME USER
-rw-r--r-- | mysql-test/main/grant.result | 9 | ||||
-rw-r--r-- | mysql-test/main/grant.test | 11 | ||||
-rw-r--r-- | sql/sql_acl.cc | 2 |
3 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/main/grant.result b/mysql-test/main/grant.result index 2b92a2bd797..50a2544f2ae 100644 --- a/mysql-test/main/grant.result +++ b/mysql-test/main/grant.result @@ -2770,3 +2770,12 @@ CREATE USER bar2@localhost; RENAME USER foo@localhost TO bar1@localhost, bar1@localhost TO bar3@localhost; DROP USER bar2@localhost; DROP USER bar3@localhost; +# +# MDEV-17946 : Unsorted acl_dbs after RENAME USER +# +CREATE USER foo; +GRANT SELECT ON test.* TO foo; +RENAME USER '' TO 'name'; +GRANT UPDATE ON test.* TO foo; +RENAME USER 'name' to ''; +DROP USER foo; diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test index 10da0af4ea5..0e09761db36 100644 --- a/mysql-test/main/grant.test +++ b/mysql-test/main/grant.test @@ -2267,3 +2267,14 @@ CREATE USER bar2@localhost; RENAME USER foo@localhost TO bar1@localhost, bar1@localhost TO bar3@localhost; DROP USER bar2@localhost; DROP USER bar3@localhost; + +--echo # +--echo # MDEV-17946 : Unsorted acl_dbs after RENAME USER +--echo # +CREATE USER foo; +GRANT SELECT ON test.* TO foo; +RENAME USER '' TO 'name'; +GRANT UPDATE ON test.* TO foo; +RENAME USER 'name' to ''; +DROP USER foo; + diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 2b21e7c2d3f..3c8eceed7d4 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -10368,6 +10368,8 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list) rebuild_acl_users(); } + /* Rebuild 'acl_dbs' since 'acl_users' has been modified */ + rebuild_acl_dbs(); /* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */ rebuild_check_host(); |