1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge remote-tracking branch 'origin/10.1' into 10.2

This commit is contained in:
Jan Lindström
2019-02-28 13:08:11 +02:00
7 changed files with 73 additions and 33 deletions

View File

@ -10116,6 +10116,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"));
@ -10182,6 +10183,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())
@ -10250,12 +10253,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());