summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index b441356df26..6fef2927938 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -10521,6 +10521,7 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
LEX_USER *user_name;
List_iterator <LEX_USER> user_list(list);
bool binlog= false;
+ bool some_users_dropped= false;
DBUG_ENTER("mysql_create_user");
DBUG_PRINT("entry", ("Handle as %s", handle_as_role ? "role" : "user"));
@@ -10580,6 +10581,8 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
result= true;
continue;
}
+ else
+ some_users_dropped= true;
// Proceed with the creation
}
else if (thd->lex->create_info.if_not_exists())
@@ -10648,12 +10651,21 @@ 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)
+ {
my_error(ER_CANNOT_USER, MYF(0),
(handle_as_role) ? "CREATE ROLE" : "CREATE USER",
wrong_users.c_ptr_safe());
+ }
if (binlog)
result |= write_bin_log(thd, FALSE, thd->query(), thd->query_length());