Commit 1e9b5cea authored by evgen@sunlight.local's avatar evgen@sunlight.local

view.result, view.test:

  Corrected test case for the bug#21261
sql_parse.cc:
  Corrected fix for bug#21261
parent 39d0ef17
......@@ -2861,6 +2861,7 @@ GRANT SELECT ON t2 TO 'user21261'@'localhost';
INSERT INTO v1 (x) VALUES (5);
UPDATE v1 SET x=1;
GRANT SELECT ON v1 TO 'user21261'@'localhost';
GRANT SELECT ON t1 TO 'user21261'@'localhost';
UPDATE v1,t2 SET x=1 WHERE x=y;
SELECT * FROM t1;
x
......
......@@ -2740,6 +2740,7 @@ INSERT INTO v1 (x) VALUES (5);
UPDATE v1 SET x=1;
CONNECTION root;
GRANT SELECT ON v1 TO 'user21261'@'localhost';
GRANT SELECT ON t1 TO 'user21261'@'localhost';
CONNECTION user21261;
UPDATE v1,t2 SET x=1 WHERE x=y;
CONNECTION root;
......
......@@ -5099,10 +5099,21 @@ bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
return 1;
/* Check rights on tables of subselects and implictly opened tables */
TABLE_LIST *subselects_tables;
TABLE_LIST *subselects_tables, *view= all_tables->view ? all_tables : 0;
if ((subselects_tables= all_tables->next_global))
{
if ((check_table_access(thd, SELECT_ACL, subselects_tables, 0)))
/*
Access rights asked for the first table of a view should be the same
as for the view
*/
if (view && subselects_tables->belong_to_view == view)
{
if (check_single_table_access (thd, privilege, subselects_tables))
return 1;
subselects_tables= subselects_tables->next_global;
}
if (subselects_tables &&
(check_table_access(thd, SELECT_ACL, subselects_tables, 0)))
return 1;
}
return 0;
......
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