mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Merge branch '10.0' into 10.1
This commit is contained in:
@@ -4939,21 +4939,10 @@ end_with_restore_list:
|
||||
case SQLCOM_SHOW_GRANTS:
|
||||
{
|
||||
LEX_USER *grant_user= lex->grant_user;
|
||||
Security_context *sctx= thd->security_ctx;
|
||||
if (!grant_user)
|
||||
goto error;
|
||||
|
||||
if (grant_user->user.str && !strcmp(sctx->priv_user, grant_user->user.str) &&
|
||||
grant_user->host.str && !strcmp(sctx->priv_host, grant_user->host.str))
|
||||
grant_user->user= current_user;
|
||||
|
||||
if (grant_user->user.str == current_user.str ||
|
||||
grant_user->user.str == current_role.str ||
|
||||
grant_user->user.str == current_user_and_current_role.str ||
|
||||
!check_access(thd, SELECT_ACL, "mysql", NULL, NULL, 1, 0))
|
||||
{
|
||||
res = mysql_show_grants(thd, grant_user);
|
||||
}
|
||||
res = mysql_show_grants(thd, grant_user);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -6653,6 +6642,7 @@ bool check_global_access(THD *thd, ulong want_access, bool no_errors)
|
||||
temporary table flag)
|
||||
@param alter_info [in] Initial list of columns and indexes for the
|
||||
table to be created
|
||||
@param create_db [in] Database of the created table
|
||||
|
||||
@retval
|
||||
false ok.
|
||||
@@ -6661,7 +6651,8 @@ bool check_global_access(THD *thd, ulong want_access, bool no_errors)
|
||||
*/
|
||||
bool check_fk_parent_table_access(THD *thd,
|
||||
HA_CREATE_INFO *create_info,
|
||||
Alter_info *alter_info)
|
||||
Alter_info *alter_info,
|
||||
const char* create_db)
|
||||
{
|
||||
Key *key;
|
||||
List_iterator<Key> key_iterator(alter_info->key_list);
|
||||
@@ -6701,10 +6692,28 @@ bool check_fk_parent_table_access(THD *thd,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (thd->lex->copy_db_to(&db_name.str, &db_name.length))
|
||||
return true;
|
||||
else
|
||||
is_qualified_table_name= false;
|
||||
{
|
||||
if (!thd->db)
|
||||
{
|
||||
db_name.str= (char *) thd->memdup(create_db, strlen(create_db)+1);
|
||||
db_name.length= strlen(create_db);
|
||||
is_qualified_table_name= true;
|
||||
|
||||
if(create_db && check_db_name(&db_name))
|
||||
{
|
||||
my_error(ER_WRONG_DB_NAME, MYF(0), db_name.str);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (thd->lex->copy_db_to(&db_name.str, &db_name.length))
|
||||
return true;
|
||||
else
|
||||
is_qualified_table_name= false;
|
||||
}
|
||||
}
|
||||
|
||||
// if lower_case_table_names is set then convert tablename to lower case.
|
||||
if (lower_case_table_names)
|
||||
@@ -8855,7 +8864,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (check_fk_parent_table_access(thd, &lex->create_info, &lex->alter_info))
|
||||
if (check_fk_parent_table_access(thd, &lex->create_info, &lex->alter_info, create_table->db))
|
||||
goto err;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user