Commit dd3b2783 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

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).
parent e89da2e0
...@@ -6407,7 +6407,7 @@ find_field_in_tables(THD *thd, Item_ident *item, ...@@ -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 find_field_in_table even in the case of information schema tables
when table_ref->field_translation != NULL. 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_merged_derived() ||
(!table_ref->is_multitable() && table_ref->merged_for_insert))) (!table_ref->is_multitable() && table_ref->merged_for_insert)))
{ {
......
...@@ -5210,8 +5210,6 @@ bool check_single_table_access(THD *thd, ulong privilege, ...@@ -5210,8 +5210,6 @@ bool check_single_table_access(THD *thd, ulong privilege,
/* Show only 1 table for check_grant */ /* Show only 1 table for check_grant */
if (!(all_tables->belong_to_view && if (!(all_tables->belong_to_view &&
(thd->lex->sql_command == SQLCOM_SHOW_FIELDS)) && (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)) check_grant(thd, privilege, all_tables, 0, 1, no_errors))
goto deny; goto deny;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment