summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-08-20 17:11:22 +0300
committerGeorgi Kodinov <joro@sun.com>2009-08-20 17:11:22 +0300
commit1317d24b333ecf9e2b9669455c337ceec4b228bf (patch)
tree7f9becefd5fd85f099cf01731039060ba43c0092 /sql/sql_acl.cc
parent4b6f5f530f06300a06794d41c96f412cf11325a7 (diff)
parent0665536995fa1afe4ac71e13451dd8258063ff36 (diff)
downloadmariadb-git-1317d24b333ecf9e2b9669455c337ceec4b228bf.tar.gz
merge of bug #46019 to 5.1-bugteam
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index ab18a2d1d04..de132d169f2 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -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)))