From dd3b27834c271e9561fcde4658ce758c30c69334 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 2 Jun 2011 10:30:05 +0300 Subject: [PATCH] Fix of privilege problem in views and PS sql/sql_base.cc: Column for views should be looked in views (not in underlying table) sql/sql_parse.cc: if we reread grants for single table we should read both database and tables grants for views (not only database grants). --- sql/sql_base.cc | 2 +- sql/sql_parse.cc | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 8a7ef52529d..e7bb5525d32 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -6407,7 +6407,7 @@ find_field_in_tables(THD *thd, Item_ident *item, find_field_in_table even in the case of information schema tables when table_ref->field_translation != NULL. */ - if (table_ref->table && + if (table_ref->table && !table_ref->view && (!table_ref->is_merged_derived() || (!table_ref->is_multitable() && table_ref->merged_for_insert))) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 5636e5bd3ef..0ae6d38ce8e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5210,8 +5210,6 @@ bool check_single_table_access(THD *thd, ulong privilege, /* Show only 1 table for check_grant */ if (!(all_tables->belong_to_view && (thd->lex->sql_command == SQLCOM_SHOW_FIELDS)) && - !(all_tables->is_view() && - all_tables->is_merged_derived()) && check_grant(thd, privilege, all_tables, 0, 1, no_errors)) goto deny;