summaryrefslogtreecommitdiff
path: root/mysql-test/t/information_schema_db.test
diff options
context:
space:
mode:
authorunknown <gluh@mysql.com/gluh.(none)>2006-07-25 17:23:25 +0500
committerunknown <gluh@mysql.com/gluh.(none)>2006-07-25 17:23:25 +0500
commit9955388a459cf976796372633497c783eafdf48b (patch)
treed9933578d1cbee2ab94159c8d1ab7352a08775ab /mysql-test/t/information_schema_db.test
parent313253190ff270f17226b40bf30f7f46089458c2 (diff)
downloadmariadb-git-9955388a459cf976796372633497c783eafdf48b.tar.gz
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any (insert,select,delete,update) privileges on underlying view then 'show fields' and select from I_S.COLUMNS table are sucsessful. mysql-test/r/information_schema_db.result: Bug#20543 select on information_schema strange warnings, view, different schemas/users test result mysql-test/t/information_schema_db.test: Bug#20543 select on information_schema strange warnings, view, different schemas/users test case sql/sql_acl.cc: Bug#20543 select on information_schema strange warnings, view, different schemas/users checked that user has privileges on underlying view and if it's true set allowed_show to true for top view. sql/sql_show.cc: Bug#20543 select on information_schema strange warnings, view, different schemas/users removed unnecessary rights check.'tables->allowed_show' check is used instead sql/sql_view.cc: Bug#20543 select on information_schema strange warnings, view, different schemas/users skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during execution of find_field_in_table_ref function. sql/table.h: Bug#20543 select on information_schema strange warnings, view, different schemas/users 'allowed_show' is set during rights check for view. If true then user has privileges for 'show create view', etc
Diffstat (limited to 'mysql-test/t/information_schema_db.test')
-rw-r--r--mysql-test/t/information_schema_db.test56
1 files changed, 56 insertions, 0 deletions
diff --git a/mysql-test/t/information_schema_db.test b/mysql-test/t/information_schema_db.test
index 2cfa766d799..83ba046423b 100644
--- a/mysql-test/t/information_schema_db.test
+++ b/mysql-test/t/information_schema_db.test
@@ -98,3 +98,59 @@ where table_schema='test';
drop function f1;
drop function f2;
drop view v1, v2;
+
+#
+# Bug#20543: select on information_schema strange warnings, view, different
+# schemas/users
+#
+#
+create database testdb_1;
+create user testdb_1@localhost;
+grant all on testdb_1.* to testdb_1@localhost with grant option;
+
+create user testdb_2@localhost;
+grant all on test.* to testdb_2@localhost with grant option;
+
+connect (testdb_1,localhost,testdb_1,,test);
+use testdb_1;
+create table t1 (f1 char(4));
+create view v1 as select f1 from t1;
+grant insert on v1 to testdb_2@localhost;
+
+create table t3 (f1 char(4), f2 char(4));
+create view v3 as select f1,f2 from t3;
+grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
+
+connect (testdb_2,localhost,testdb_2,,test);
+create view v2 as select f1 from testdb_1.v1;
+create view v4 as select f1,f2 from testdb_1.v3;
+
+connection testdb_1;
+revoke insert(f1) on v3 from testdb_2@localhost;
+connection testdb_2;
+
+--error 1345
+show create view v4;
+--error 1345
+show fields from v4;
+
+show fields from v2;
+show fields from testdb_1.v1;
+show create view v2;
+--error 1142
+show create view testdb_1.v1;
+
+select table_name from information_schema.columns a
+where a.table_name = 'v2';
+select view_definition from information_schema.views a
+where a.table_name = 'v2';
+select view_definition from information_schema.views a
+where a.table_name = 'testdb_1.v1';
+
+--error 1356
+select * from v2;
+
+connection default;
+drop view testdb_1.v1,v2, testdb_1.v3, v4;
+drop database testdb_1;
+drop user testdb_1@localhost;