summaryrefslogtreecommitdiff
path: root/mysql-test/t/grant2.test
diff options
context:
space:
mode:
authorunknown <jani@a193-229-222-105.elisa-laajakaista.fi>2005-03-18 13:32:28 +0200
committerunknown <jani@a193-229-222-105.elisa-laajakaista.fi>2005-03-18 13:32:28 +0200
commitc94570057c9f7861d40971f77c794ea05635b83a (patch)
tree5c0bffa6d1ac69b2b7cd0e0dbfa6f2bb92cff785 /mysql-test/t/grant2.test
parent0f58efbd487dd1b82c6dd3b5e60304a168793eea (diff)
downloadmariadb-git-c94570057c9f7861d40971f77c794ea05635b83a.tar.gz
Added more tests to grant2. Fixed some previous tests.
Added new logic to ACL system: 1) If GRANT OPTION (not mysql db): Ok to update existing user, but not password. Not allowed to make a new user. 2) If UPDATE_ACL to mysql DB: Ok to update current user, but not make a new one. 3) If INSERT_ACL to mysql DB: Ok to add a new user, but not modify existing. 4) If GRANT OPTION to mysql DB: All modifications OK. mysql-test/r/grant2.result: Added more ACL tests and fixed results in some old tests. mysql-test/t/grant2.test: Added more ACL tests and fixed results in some old tests. sql/sql_acl.h: Made check_acl_user() visible to sql_parse.cc sql/sql_parse.cc: Added new logic to ACL system: 1) If GRANT OPTION (not mysql db): Ok to update existing user, but not password. Not allowed to make a new user. 2) If UPDATE_ACL to mysql DB: Ok to update current user, but not make a new one. 3) If INSERT_ACL to mysql DB: Ok to add a new user, but not modify existing. 4) If GRANT OPTION to mysql DB: All modifications OK.
Diffstat (limited to 'mysql-test/t/grant2.test')
-rw-r--r--mysql-test/t/grant2.test39
1 files changed, 36 insertions, 3 deletions
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index 58f91fddcc2..f86cf2a1db7 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -17,6 +17,36 @@ delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
+grant all privileges on `my\_1`.* to mysqltest_1@localhost with grant option;
+create user mysqltest_2@localhost;
+connect (user_a,localhost,mysqltest_1,,);
+connection user_a;
+grant select on `my\_1`.* to mysqltest_2@localhost;
+--error 1132
+grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
+disconnect user_a;
+connection default;
+grant update on mysql.* to mysqltest_1@localhost;
+connect (user_b,localhost,mysqltest_1,,);
+connection user_b;
+grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
+--error 1211
+grant select on `my\_1`.* to mysqltest_3@localhost;
+disconnect user_b;
+connection default;
+grant insert on mysql.* to mysqltest_1@localhost;
+connect (user_c,localhost,mysqltest_1,,);
+connection user_c;
+grant select on `my\_1`.* to mysqltest_3@localhost;
+grant select on `my\_1`.* to mysqltest_4@localhost identified by 'pass';
+disconnect user_c;
+connection default;
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+delete from mysql.columns_priv where user like 'mysqltest\_%';
+flush privileges;
+
#
# wild_compare fun
#
@@ -26,9 +56,11 @@ connect (user1,localhost,mysqltest_1,,);
connection user1;
select current_user();
select current_user;
+--error 1211
grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
--error 1044
grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;
+
#
# NO_AUTO_CREATE_USER mode
#
@@ -36,12 +68,13 @@ set @@sql_mode='NO_AUTO_CREATE_USER';
select @@sql_mode;
--error 1211
grant select on `my\_1`.* to mysqltest_4@localhost with grant option;
---error 1044
+--error 1211
grant select on `my\_1`.* to mysqltest_4@localhost identified by 'mypass'
with grant option;
disconnect user1;
connection default;
show grants for mysqltest_1@localhost;
+--error 1141
show grants for mysqltest_2@localhost;
--error 1141
show grants for mysqltest_3@localhost;
@@ -83,9 +116,9 @@ create table t1 (a int, b int);
grant select (a) on t1 to mysqltest_1@localhost with grant option;
connect (mrugly, localhost, mysqltest_1,,mysqltest);
connection mrugly;
---error 1143
+--error 1211
grant select (a,b) on t1 to mysqltest_2@localhost;
---error 1142
+--error 1211
grant select on t1 to mysqltest_3@localhost;
disconnect mrugly;