Commit d0394c70 authored by unknown's avatar unknown

view.result, view.test:

  Corrected test case for the bug#21261
sql_parse.cc:
  Corrected fix for bug#21261


mysql-test/t/view.test:
  Corrected test case for the bug#21261
mysql-test/r/view.result:
  Corrected test case for the bug#21261
sql/sql_parse.cc:
  Corrected fix for bug#21261
parent e8bb0c92
...@@ -2861,6 +2861,7 @@ GRANT SELECT ON t2 TO 'user21261'@'localhost'; ...@@ -2861,6 +2861,7 @@ GRANT SELECT ON t2 TO 'user21261'@'localhost';
INSERT INTO v1 (x) VALUES (5); INSERT INTO v1 (x) VALUES (5);
UPDATE v1 SET x=1; UPDATE v1 SET x=1;
GRANT SELECT ON v1 TO 'user21261'@'localhost'; GRANT SELECT ON v1 TO 'user21261'@'localhost';
GRANT SELECT ON t1 TO 'user21261'@'localhost';
UPDATE v1,t2 SET x=1 WHERE x=y; UPDATE v1,t2 SET x=1 WHERE x=y;
SELECT * FROM t1; SELECT * FROM t1;
x x
......
...@@ -2740,6 +2740,7 @@ INSERT INTO v1 (x) VALUES (5); ...@@ -2740,6 +2740,7 @@ INSERT INTO v1 (x) VALUES (5);
UPDATE v1 SET x=1; UPDATE v1 SET x=1;
CONNECTION root; CONNECTION root;
GRANT SELECT ON v1 TO 'user21261'@'localhost'; GRANT SELECT ON v1 TO 'user21261'@'localhost';
GRANT SELECT ON t1 TO 'user21261'@'localhost';
CONNECTION user21261; CONNECTION user21261;
UPDATE v1,t2 SET x=1 WHERE x=y; UPDATE v1,t2 SET x=1 WHERE x=y;
CONNECTION root; CONNECTION root;
......
...@@ -5099,10 +5099,21 @@ bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables) ...@@ -5099,10 +5099,21 @@ bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
return 1; return 1;
/* Check rights on tables of subselects and implictly opened tables */ /* 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 ((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 1;
} }
return 0; 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