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

merge of bug #46019 to 5.1-bugteam

This commit is contained in:
Georgi Kodinov
2009-08-20 17:11:22 +03:00
5 changed files with 77 additions and 3 deletions

View File

@ -3905,11 +3905,15 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
continue; // ok
if (!(~table->grant.privilege & want_access) ||
table->is_anonymous_derived_table() || table->schema_table)
(table->is_anonymous_derived_table() &&
table->is_non_materialized_derived_table()) || table->schema_table)
{
/*
It is subquery in the FROM clause. VIEW set table->derived after
table opening, but this function always called before table opening.
table opening, but this function is mostly called before table opening.
When it's called after table opening e.g. for nested views with
materialization we shoud check the materialized table for access as
any other table.
*/
if (!table->referencing_view)
{
@ -3922,6 +3926,7 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
}
continue;
}
if (!(grant_table= table_hash_search(sctx->host, sctx->ip,
table->get_db_name(), sctx->priv_user,
table->get_table_name(), FALSE)))