summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorunknown <evgen@sunlight.local>2006-08-15 21:45:24 +0400
committerunknown <evgen@sunlight.local>2006-08-15 21:45:24 +0400
commita23d1792bc48c55eb8bee2f3aa947b9599ade190 (patch)
treea81bf82a292cd0862ecfaedcf0c1317a9ccdb0a7 /sql/sql_base.cc
parent51bb3b2a7f906af25b5dd0ef91491aa415615a4b (diff)
downloadmariadb-git-a23d1792bc48c55eb8bee2f3aa947b9599ade190.tar.gz
Fixed bug#21261: Wrong access rights was required for an insert into a view
SELECT right instead of INSERT right was required for an insert into to a view. This wrong behaviour appeared after the fix for bug #20989. Its intention was to ask only SELECT right for all tables except the very first for a complex INSERT query. But that patch has done it in a wrong way and lead to asking a wrong access right for an insert into a view. The setup_tables_and_check_access() function now accepts two want_access parameters. One will be used for the first table and the second for other tables. mysql-test/t/view.test: Added a test case for bug#21261: Wrong access rights was required for an insert into a view mysql-test/r/view.result: Added a test case for bug#21261: Wrong access rights was required for an insert into a view sql/sql_update.cc: Fixed bug#21261: Wrong access rights was required for an insert into a view Modified to use updated setup_tables_and_check_access() function. sql/sql_select.cc: Fixed bug#21261: Wrong access rights was required for an insert into a view Modified to use updated setup_tables_and_check_access() function. sql/sql_load.cc: Fixed bug#21261: Wrong access rights was required for an insert into a view Modified to use updated setup_tables_and_check_access() function. sql/sql_insert.cc: Fixed bug#21261: Wrong access rights was required for an insert into a view Modified to use updated setup_tables_and_check_access() function. sql/sql_delete.cc: Fixed bug#21261: Wrong access rights was required for an insert into a view Modified to use updated setup_tables_and_check_access() function. sql/sql_base.cc: Fixed bug#21261: Wrong access rights was required for an insert into a view The setup_tables_and_check_access() function now accepts two want_access parameters. One will be used for the first table and the second for other tables. sql/mysql_priv.h: Fixed bug#21261: Wrong access rights was required for an insert into a view The setup_tables_and_check_access() function now accepts two want_access parameters.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 1bdc0103853..3a12477bc15 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -4563,9 +4563,11 @@ bool setup_tables_and_check_access(THD *thd,
TABLE_LIST *tables,
Item **conds, TABLE_LIST **leaves,
bool select_insert,
+ ulong want_access_first,
ulong want_access)
{
TABLE_LIST *leaves_tmp = NULL;
+ bool first_table= true;
if (setup_tables (thd, context, from_clause, tables, conds,
&leaves_tmp, select_insert))
@@ -4575,13 +4577,16 @@ bool setup_tables_and_check_access(THD *thd,
*leaves = leaves_tmp;
for (; leaves_tmp; leaves_tmp= leaves_tmp->next_leaf)
+ {
if (leaves_tmp->belong_to_view &&
- check_single_table_access(thd, want_access, leaves_tmp))
+ check_single_table_access(thd, first_table ? want_access_first :
+ want_access, leaves_tmp))
{
tables->hide_view_error(thd);
return TRUE;
}
-
+ first_table= false;
+ }
return FALSE;
}