diff options
author | unknown <gkodinov/kgeorge@magare.gmz> | 2007-09-27 12:15:19 +0300 |
---|---|---|
committer | unknown <gkodinov/kgeorge@magare.gmz> | 2007-09-27 12:15:19 +0300 |
commit | 66f13d91208fd3fe9570ef705e350728f63f4727 (patch) | |
tree | 08e93bc69dd1af0199f82521afc1c2c4e0f6f117 /mysql-test/t/grant2.test | |
parent | bd1f34d932237f2d401452f752bda7dd21f03e26 (diff) | |
download | mariadb-git-66f13d91208fd3fe9570ef705e350728f63f4727.tar.gz |
Bug #30468: column level privileges not respected when joining tables
When expanding a * in a USING/NATURAL join the check for table access
for both tables in the join was done using the grant information of the
first one.
Fixed by getting the grant information for the current table while
iterating through the columns of the join.
mysql-test/r/grant2.result:
Bug #30468: test case
mysql-test/t/grant2.test:
Bug #30468: test case
sql/sql_acl.cc:
Bug #30468: correctly check column grants
sql/sql_acl.h:
Bug #30468: correctly check column grants
sql/sql_base.cc:
Bug #30468: correctly check column grants
sql/sql_insert.cc:
Bug #30468: correctly check column grants
Diffstat (limited to 'mysql-test/t/grant2.test')
-rw-r--r-- | mysql-test/t/grant2.test | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index a3a8e2d5d53..e2d92ee58d4 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -585,5 +585,37 @@ drop user mysqltest_1@localhost; drop user mysqltest_2@localhost; +# +# Bug #30468: column level privileges not respected when joining tables +# +CREATE DATABASE db1; + +USE db1; +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1),(2,2); + +CREATE TABLE t2 (b INT, c INT); +INSERT INTO t2 VALUES (1,100),(2,200); + +GRANT SELECT ON t1 TO mysqltest1@localhost; +GRANT SELECT (b) ON t2 TO mysqltest1@localhost; + +connect (conn1,localhost,mysqltest1,,); +connection conn1; +USE db1; +--error ER_COLUMNACCESS_DENIED_ERROR +SELECT c FROM t2; +--error ER_COLUMNACCESS_DENIED_ERROR +SELECT * FROM t2; +--error ER_COLUMNACCESS_DENIED_ERROR +SELECT * FROM t1 JOIN t2 USING (b); + +connection default; +disconnect conn1; +DROP TABLE db1.t1, db1.t2; +DROP USER mysqltest1@localhost; +DROP DATABASE db1; + + --echo End of 5.0 tests |