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
commitf4676ae522d57c8f98f1b9e547a82331f268c0a1 (patch)
tree7f9becefd5fd85f099cf01731039060ba43c0092 /sql/sql_acl.cc
parent388955a4c318d0041e1fbf0b3c40b33f3477a709 (diff)
parent4207e50e23cd5b964e4223b61048cd2b5729358f (diff)
downloadmariadb-git-f4676ae522d57c8f98f1b9e547a82331f268c0a1.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)))