diff options
author | unknown <tsmith@ramayana.hindu.god> | 2007-12-07 03:56:03 -0700 |
---|---|---|
committer | unknown <tsmith@ramayana.hindu.god> | 2007-12-07 03:56:03 -0700 |
commit | 284cb0e560293187b9d2d7a38aa71de9d9637567 (patch) | |
tree | b719b75e443bf2787a2c520cc6e9955e4eb6a4a8 /mysql-test/t/grant.test | |
parent | b5f919ddfa3bfe6202302bb3e88e252c68550ed7 (diff) | |
parent | 6e776686d4cbaac919eee8300b2c85e2cf5825ec (diff) | |
download | mariadb-git-284cb0e560293187b9d2d7a38aa71de9d9637567.tar.gz |
Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.1
into ramayana.hindu.god:/home/tsmith/m/bk/maint/51
sql/sql_acl.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_table.cc:
Auto merged
mysql-test/r/grant.result:
Manual merge
mysql-test/t/grant.test:
Manual merge
Diffstat (limited to 'mysql-test/t/grant.test')
-rw-r--r-- | mysql-test/t/grant.test | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 2a1940f4326..d9ee38d0c14 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -1235,6 +1235,7 @@ DROP DATABASE mysqltest1; DROP DATABASE mysqltest2; DROP USER mysqltest_1@localhost; +DROP USER mysqltest_2@localhost; # # Bug#27878: Unchecked privileges on a view referring to a table from another @@ -1260,6 +1261,7 @@ connection default; REVOKE UPDATE (f1) ON `test`.`t1` FROM 'mysqltest_1'@'localhost'; REVOKE SELECT ON `test`.* FROM 'mysqltest_1'@'localhost'; REVOKE ALL ON db27878.* FROM 'mysqltest_1'@'localhost'; +DROP USER mysqltest_1@localhost; DROP DATABASE db27878; use test; DROP TABLE t1; @@ -1278,6 +1280,82 @@ drop user юзер_юзер@localhost; grant select on test.* to очень_длинный_юзер@localhost; set names default; +# +# Bug #20901 - CREATE privilege is enough to insert into a table +# + +create database mysqltest; +use mysqltest; + +grant create on mysqltest.* to mysqltest@localhost; +create table t1 (i INT); + +connect (user1,localhost,mysqltest,,mysqltest); +connection user1; +# show we don't have INSERT +--error 1142 +insert into t1 values (1); +# show we have CREATE +create table t2 (i INT); +create table t4 (i INT); + +connection default; +grant select, insert on mysqltest.t2 to mysqltest@localhost; +grant insert on mysqltest.t4 to mysqltest@localhost; +# to specify ACLs for non-existent objects, must explictly |CREATE +grant create, insert on mysqltest.t5 to mysqltest@localhost; +grant create, insert on mysqltest.t6 to mysqltest@localhost; +flush privileges; + +connection user1; +insert into t2 values (1); + + +# CREATE IF NOT EXISTS...SELECT, t1 exists, no INSERT, must fail +--error 1142 +create table if not exists t1 select * from t2; + +# CREATE IF NOT EXISTS...SELECT, no t3 yet, no INSERT, must fail +--error 1142 +create table if not exists t3 select * from t2; + +# CREATE IF NOT EXISTS...SELECT, t4 exists, have INSERT, must succeed +create table if not exists t4 select * from t2; + +# CREATE IF NOT EXISTS...SELECT, no t5 yet, have INSERT, must succeed +create table if not exists t5 select * from t2; + + +# CREATE...SELECT, no t6 yet, have INSERT, must succeed +create table t6 select * from t2; + +# CREATE...SELECT, no t7 yet, no INSERT, must fail +--error 1142 +create table t7 select * from t2; + +# CREATE...SELECT, t4 exists, have INSERT, must still fail (exists) +--error 1050 +create table t4 select * from t2; + +# CREATE...SELECT, t1 exists, no INSERT, must fail +--error 1142 +create table t1 select * from t2; + + +connection default; +drop table t1,t2,t4,t5,t6; + +revoke create on mysqltest.* from mysqltest@localhost; +revoke select, insert on mysqltest.t2 from mysqltest@localhost; +revoke insert on mysqltest.t4 from mysqltest@localhost; +revoke create, insert on mysqltest.t5 from mysqltest@localhost; +revoke create, insert on mysqltest.t6 from mysqltest@localhost; +drop user mysqltest@localhost; + +disconnect user1; +drop database mysqltest; +use test; + # # Bug #16470 crash on grant if old grant tables @@ -1297,3 +1375,5 @@ DROP DATABASE mysqltest1; RENAME TABLE mysql.procs_gone TO mysql.procs_priv; FLUSH PRIVILEGES; + +--echo End of 5.1 tests |