diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-03-04 17:01:00 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-03-04 17:01:00 +0200 |
commit | a2fc36989e13c6f322fd22791f67e0d1275461d7 (patch) | |
tree | 9cba675c50883e2e45c61a94b631d8875d16ddf9 /sql/sql_acl.cc | |
parent | 82da98556cf58f0fbb43c82e9c6ae1a887b6cf3d (diff) | |
parent | 74d648db12e100c628548fb2e5aa67de718bd1fb (diff) | |
download | mariadb-git-a2fc36989e13c6f322fd22791f67e0d1275461d7.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r-- | sql/sql_acl.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index b36db5040ac..16c70b3ed92 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -10145,6 +10145,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")); @@ -10211,6 +10212,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()) @@ -10279,12 +10282,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()); |