summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2019-02-20 22:35:21 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2019-02-20 22:35:21 +0100
commitd9f7b6be5aa8d0eea18d1f122338b6058c03fdc3 (patch)
treedf931843ca15a18c71535e7dd37ae488e938c35a /sql/sql_acl.cc
parent39a2984dc00925c8e08917c9313eaa03b82011f4 (diff)
downloadmariadb-git-d9f7b6be5aa8d0eea18d1f122338b6058c03fdc3.tar.gz
MDEV-17942 fixup : protect rebuild_check_host() / rebuild_role_grants() with acl_cache->lock mutex
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index a7d1f6a1b38..6052284428e 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -9573,16 +9573,17 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
}
}
+ if (result && some_users_dropped && !handle_as_role)
+ {
+ /* Rebuild in-memory structs, since 'acl_users' has been modified */
+ rebuild_check_host();
+ rebuild_role_grants();
+ }
+
mysql_mutex_unlock(&acl_cache->lock);
if (result)
{
- if (some_users_dropped && !handle_as_role)
- {
- /* Rebuild in-memory structs, since 'acl_users' has been modified */
- rebuild_check_host();
- rebuild_role_grants();
- }
my_error(ER_CANNOT_USER, MYF(0),
(handle_as_role) ? "CREATE ROLE" : "CREATE USER",
wrong_users.c_ptr_safe());