summaryrefslogtreecommitdiff
path: root/mysql-test/r/view_grant.result
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2007-03-22 22:05:19 +0300
committerunknown <evgen@moonbone.local>2007-03-22 22:05:19 +0300
commit9b774e8f8d472a5cf20c42643b342378511ed4b7 (patch)
tree7ab9dc82dca2104243ca9c1a14bd6dc6e2941943 /mysql-test/r/view_grant.result
parent6d93f15039d551f291232c1b60527b00cd9c6bc9 (diff)
downloadmariadb-git-9b774e8f8d472a5cf20c42643b342378511ed4b7.tar.gz
Bug#26813: The SUPER privilege is wrongly required to alter a view created by
another user. When the DEFINER clause isn't specified in the ALTER statement then it's loaded from the view definition. If the definer differs from the current user then the error is thrown because only a super-user can set other users as a definers. Now if the DEFINER clause is omitted in the ALTER VIEW statement then the definer from the original view is used without check. mysql-test/t/view_grant.test: Added a test case for the bug#27006: The SUPER privilege is wrongly required to alter a view created by another user. mysql-test/r/view_grant.result: Added a test case for the bug#27006: The SUPER privilege is wrongly required to alter a view created by another user. sql/sql_view.cc: Bug#26813: The SUPER privilege is wrongly required to alter a view created by another user. Now if the DEFINER clause is omitted in the ALTER VIEW statement then the definer from the original view is used without check.
Diffstat (limited to 'mysql-test/r/view_grant.result')
-rw-r--r--mysql-test/r/view_grant.result21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result
index 45cf5076fe1..6fec52896c9 100644
--- a/mysql-test/r/view_grant.result
+++ b/mysql-test/r/view_grant.result
@@ -773,4 +773,25 @@ DROP DATABASE mysqltest_db1;
DROP DATABASE mysqltest_db2;
DROP USER mysqltest_u1@localhost;
DROP USER mysqltest_u2@localhost;
+CREATE DATABASE db26813;
+USE db26813;
+CREATE TABLE t1(f1 INT, f2 INT);
+CREATE VIEW v1 AS SELECT f1 FROM t1;
+CREATE VIEW v2 AS SELECT f1 FROM t1;
+CREATE VIEW v3 AS SELECT f1 FROM t1;
+CREATE USER u26813@localhost;
+GRANT DROP ON db26813.v1 TO u26813@localhost;
+GRANT CREATE VIEW ON db26813.v2 TO u26813@localhost;
+GRANT DROP, CREATE VIEW ON db26813.v3 TO u26813@localhost;
+GRANT SELECT ON db26813.t1 TO u26813@localhost;
+ALTER VIEW v1 AS SELECT f2 FROM t1;
+ERROR 42000: CREATE VIEW command denied to user 'u26813'@'localhost' for table 'v1'
+ALTER VIEW v2 AS SELECT f2 FROM t1;
+ERROR 42000: DROP command denied to user 'u26813'@'localhost' for table 'v2'
+ALTER VIEW v3 AS SELECT f2 FROM t1;
+SHOW CREATE VIEW v3;
+View Create View
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f2` AS `f2` from `t1`
+DROP USER u26813@localhost;
+DROP DATABASE db26813;
End of 5.0 tests.