diff options
author | Patrick Crews <patrick.crews@sun.com> | 2009-02-27 10:45:19 +0200 |
---|---|---|
committer | Patrick Crews <patrick.crews@sun.com> | 2009-02-27 10:45:19 +0200 |
commit | 1dc084f35817cb1180c233809de89a18d8cf076c (patch) | |
tree | 87402b78cb28cb82b3fa4eb8b94b1d322c1bb0d6 /mysql-test | |
parent | afdf8a447f538a20f61fc4d7cea26975da53e973 (diff) | |
parent | ee772168032cde8f6dc7abf8155f573ccd96afeb (diff) | |
download | mariadb-git-1dc084f35817cb1180c233809de89a18d8cf076c.tar.gz |
merge.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/grant.result | 2 | ||||
-rw-r--r-- | mysql-test/r/grant2.result | 2 | ||||
-rw-r--r-- | mysql-test/r/information_schema_db.result | 2 | ||||
-rw-r--r-- | mysql-test/r/mysql.result | 4 | ||||
-rw-r--r-- | mysql-test/r/mysqldump.result | 2 | ||||
-rw-r--r-- | mysql-test/r/ps.result | 2 | ||||
-rw-r--r-- | mysql-test/r/sp.result | 4 | ||||
-rw-r--r-- | mysql-test/r/view_grant.result | 30 | ||||
-rw-r--r-- | mysql-test/t/grant2.test | 2 | ||||
-rw-r--r-- | mysql-test/t/mysql.test | 17 | ||||
-rw-r--r-- | mysql-test/t/ps.test | 9 | ||||
-rw-r--r-- | mysql-test/t/view_grant.test | 40 |
12 files changed, 105 insertions, 11 deletions
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 97945a702d8..7a5b0520f7c 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -457,7 +457,7 @@ Privilege Context Comment Alter Tables To alter the table Alter routine Functions,Procedures To alter or drop stored functions/procedures Create Databases,Tables,Indexes To create new databases and tables -Create routine Functions,Procedures To use CREATE FUNCTION/PROCEDURE +Create routine Databases To use CREATE FUNCTION/PROCEDURE Create temporary tables Databases To use CREATE TEMPORARY TABLE Create view Tables To create new views Create user Server Admin To create new users diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index 95748c89103..698e602e2e6 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -433,7 +433,7 @@ USE db1; SELECT c FROM t2; ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2' SELECT * FROM t2; -ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2' +ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for table 't2' SELECT * FROM t1 JOIN t2 USING (b); ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2' USE test; diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result index b9c3358f47e..67c9921e1ca 100644 --- a/mysql-test/r/information_schema_db.result +++ b/mysql-test/r/information_schema_db.result @@ -188,7 +188,7 @@ Field Type Null Key Default Extra f1 char(4) YES NULL show create view v2; View Create View -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1` +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1` show create view testdb_1.v1; ERROR 42000: SHOW VIEW command denied to user 'testdb_2'@'localhost' for table 'v1' select table_name from information_schema.columns a diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index 9bad3b9f791..10537f6da16 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -188,4 +188,8 @@ delimiter 2 @z:='1' @z=database() 1 NULL +1 +1 +1 +1 End of 5.0 tests diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index c612f6c5073..49430a5c62d 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -3246,7 +3246,7 @@ USE `mysqldump_views`; /*!50001 DROP TABLE `nasishnasifu`*/; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */; +/*!50001 VIEW `nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */; drop view nasishnasifu; drop database mysqldump_views; drop table mysqldump_tables.basetable; diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 09deaf2f322..d3fbbf0d538 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -235,7 +235,7 @@ execute stmt1; prepare stmt1 from "insert into t1 select i from t1"; execute stmt1; execute stmt1; -prepare stmt1 from "select * from t1 into outfile 'f1.txt'"; +prepare stmt1 from "select * from t1 into outfile '<MYSQLTEST_VARDIR>/tmp/f1.txt'"; execute stmt1; deallocate prepare stmt1; drop table t1; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index bfa2f51e4fc..84a4166a45d 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -2475,7 +2475,7 @@ Privilege Context Comment Alter Tables To alter the table Alter routine Functions,Procedures To alter or drop stored functions/procedures Create Databases,Tables,Indexes To create new databases and tables -Create routine Functions,Procedures To use CREATE FUNCTION/PROCEDURE +Create routine Databases To use CREATE FUNCTION/PROCEDURE Create temporary tables Databases To use CREATE TEMPORARY TABLE Create view Tables To create new views Create user Server Admin To create new users @@ -2527,7 +2527,7 @@ Privilege Context Comment Alter Tables To alter the table Alter routine Functions,Procedures To alter or drop stored functions/procedures Create Databases,Tables,Indexes To create new databases and tables -Create routine Functions,Procedures To use CREATE FUNCTION/PROCEDURE +Create routine Databases To use CREATE FUNCTION/PROCEDURE Create temporary tables Databases To use CREATE TEMPORARY TABLE Create view Tables To create new views Create user Server Admin To create new users diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 53ad8642ba4..1df8ed335a7 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -26,7 +26,7 @@ create view v2 as select * from mysqltest.t2; ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2' show create view v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` grant create view,drop,select on test.* to mysqltest_1@localhost; use test; alter view v1 as select * from mysqltest.t1; @@ -307,7 +307,7 @@ grant create view,select on test.* to mysqltest_1@localhost; create view v1 as select * from mysqltest.t1; show create view v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` revoke select on mysqltest.t1 from mysqltest_1@localhost; select * from v1; ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them @@ -919,4 +919,30 @@ c4 DROP DATABASE mysqltest1; DROP DATABASE mysqltest2; DROP USER mysqltest_u1@localhost; +CREATE DATABASE db1; +USE db1; +CREATE TABLE t1(f1 INT, f2 INT); +CREATE VIEW v1 AS SELECT f1, f2 FROM t1; +GRANT SELECT (f1) ON t1 TO foo; +GRANT SELECT (f1) ON v1 TO foo; +USE db1; +SELECT f1 FROM t1; +f1 +SELECT f2 FROM t1; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'f2' in table 't1' +SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +SELECT f1 FROM v1; +f1 +SELECT f2 FROM v1; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'f2' in table 'v1' +SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'v1' +USE test; +REVOKE SELECT (f1) ON db1.t1 FROM foo; +REVOKE SELECT (f1) ON db1.v1 FROM foo; +DROP USER foo; +DROP VIEW db1.v1; +DROP TABLE db1.t1; +DROP DATABASE db1; End of 5.0 tests. diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index 8f83c365170..2393bb1c6d8 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -615,7 +615,7 @@ connection conn1; USE db1; --error ER_COLUMNACCESS_DENIED_ERROR SELECT c FROM t2; ---error ER_COLUMNACCESS_DENIED_ERROR +--error ER_TABLEACCESS_DENIED_ERROR SELECT * FROM t2; --error ER_COLUMNACCESS_DENIED_ERROR SELECT * FROM t1 JOIN t2 USING (b); diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 68a01a309d4..594d10e46a5 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -314,4 +314,21 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug38158.sql; # --exec $MYSQL -e "select @z:='1',@z=database()" + +# +# Bug #31060: MySQL CLI parser bug 2 +# + +--write_file $MYSQLTEST_VARDIR/tmp/bug31060.sql +;DELIMITER DELIMITER +; +SELECT 1DELIMITER +DELIMITER ; +SELECT 1; +EOF + +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug31060.sql 2>&1 + +remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql; + --echo End of 5.0 tests diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 6c3f98f6a1a..d9e593fd76f 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -228,6 +228,10 @@ drop table t1; # statements or are correctly created and deleted on each execute # +--let $outfile=$MYSQLTEST_VARDIR/tmp/f1.txt +--error 0,1 +--remove_file $outfile + prepare stmt1 from "select 1 into @var"; execute stmt1; execute stmt1; @@ -238,11 +242,14 @@ execute stmt1; prepare stmt1 from "insert into t1 select i from t1"; execute stmt1; execute stmt1; -prepare stmt1 from "select * from t1 into outfile 'f1.txt'"; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval prepare stmt1 from "select * from t1 into outfile '$outfile'"; execute stmt1; deallocate prepare stmt1; drop table t1; +--remove_file $outfile + # # BUG#5242 "Prepared statement names are case sensitive" # diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test index be9daacec4f..c8b31f711b5 100644 --- a/mysql-test/t/view_grant.test +++ b/mysql-test/t/view_grant.test @@ -1185,4 +1185,44 @@ DROP DATABASE mysqltest1; DROP DATABASE mysqltest2; DROP USER mysqltest_u1@localhost; + +# +# Bug #41354: Access control is bypassed when all columns of a view are +# selected by * wildcard + +CREATE DATABASE db1; +USE db1; +CREATE TABLE t1(f1 INT, f2 INT); +CREATE VIEW v1 AS SELECT f1, f2 FROM t1; + +GRANT SELECT (f1) ON t1 TO foo; +GRANT SELECT (f1) ON v1 TO foo; + +connect (addconfoo, localhost, foo,,); +connection addconfoo; +USE db1; + + +SELECT f1 FROM t1; +--error ER_COLUMNACCESS_DENIED_ERROR +SELECT f2 FROM t1; +--error ER_TABLEACCESS_DENIED_ERROR +SELECT * FROM t1; + +SELECT f1 FROM v1; +--error ER_COLUMNACCESS_DENIED_ERROR +SELECT f2 FROM v1; +--error ER_TABLEACCESS_DENIED_ERROR +SELECT * FROM v1; + +connection default; +USE test; +disconnect addconfoo; +REVOKE SELECT (f1) ON db1.t1 FROM foo; +REVOKE SELECT (f1) ON db1.v1 FROM foo; +DROP USER foo; +DROP VIEW db1.v1; +DROP TABLE db1.t1; +DROP DATABASE db1; + --echo End of 5.0 tests. |