summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormonty@donna.mysql.com <>2000-08-29 19:38:32 +0300
committermonty@donna.mysql.com <>2000-08-29 19:38:32 +0300
commit306640e2747756fc201cf74508f1cbd8f1d48327 (patch)
tree11ed770fa863e0b50af0b27d2c231817f7655ef8 /tests
parent233857343574c3c80cbcc7f7f749e76fa33a1901 (diff)
downloadmariadb-git-306640e2747756fc201cf74508f1cbd8f1d48327.tar.gz
Updates for release
Diffstat (limited to 'tests')
-rw-r--r--tests/grant.pl29
-rw-r--r--tests/grant.res40
2 files changed, 47 insertions, 22 deletions
diff --git a/tests/grant.pl b/tests/grant.pl
index a34a2909897..0219fdb71ee 100644
--- a/tests/grant.pl
+++ b/tests/grant.pl
@@ -40,9 +40,9 @@ $columns_cols="Host, Db, User, Table_name, Column_name, Column_priv";
# clear grant tables
#
-$dbh = DBI->connect("DBI:mysql:mysql:$opt_host;mysql_read_default_group=perl",
+$dbh = DBI->connect("DBI:mysql:mysql:$opt_host",
$opt_root_user,$opt_password,
- { PrintError => 0}) || die "Can't connect to mysql server: $DBI::errstr\n";
+ { PrintError => 0}) || die "Can't connect to mysql server with user '$opt_root_user': $DBI::errstr\n";
safe_query("delete from user where user='$opt_user' or user='${opt_user}2'");
safe_query("delete from db where user='$opt_user'");
@@ -171,8 +171,7 @@ user_query("create table $opt_database.test2 (a int not null)");
user_query("alter table $opt_database.test2 add b int");
user_query("create index dummy on $opt_database.test2 (a)");
user_query("drop table $opt_database.test2");
-user_query("show tables");
-
+user_query("show tables from grant_test");
# These should fail
user_query("insert into mysql.user (host,user) values ('error','$opt_user',0)",1);
@@ -242,7 +241,22 @@ user_query("grant select on $opt_database.test2 to $user with grant option",1);
safe_query("grant drop on $opt_database.test2 to $user with grant option");
user_query("grant drop on $opt_database.test2 to $user with grant option");
user_query("grant select on $opt_database.test2 to $user with grant option",1);
-user_query("drop table $opt_database.test2");
+
+# check rename privileges
+user_query("rename table $opt_database.test2 to $opt_database.test3",1);
+safe_query("grant CREATE,DROP on $opt_database.test3 to $user");
+user_query("rename table $opt_database.test2 to $opt_database.test3",1);
+user_query("create table $opt_database.test3 (a int)");
+safe_query("grant INSERT on $opt_database.test3 to $user");
+user_query("drop table $opt_database.test3");
+user_query("rename table $opt_database.test2 to $opt_database.test3");
+user_query("rename table $opt_database.test3 to $opt_database.test2",1);
+safe_query("grant ALTER on $opt_database.test3 to $user");
+user_query("rename table $opt_database.test3 to $opt_database.test2");
+safe_query("revoke DROP on $opt_database.test2 from $user");
+user_query("rename table $opt_database.test2 to $opt_database.test3");
+user_query("drop table if exists $opt_database.test2,$opt_database.test3",1);
+safe_query("drop table if exists $opt_database.test2,$opt_database.test3");
# Check that the user doesn't have some user privileges
user_query("create database $opt_database",1);
@@ -253,9 +267,9 @@ safe_query("flush privileges");
safe_query("select $tables_cols from mysql.tables_priv");
safe_query("revoke ALL PRIVILEGES on $opt_database.test from $user");
safe_query("revoke ALL PRIVILEGES on $opt_database.test2 from $user");
+safe_query("revoke ALL PRIVILEGES on $opt_database.test3 from $user");
safe_query("revoke GRANT OPTION on $opt_database.test2 from $user");
safe_query("select $tables_cols from mysql.tables_priv");
-
user_query("select count(a) from test",1);
#
@@ -435,7 +449,8 @@ sub print_info
my $tmp;
print <<EOF;
This test will clear your table and column grant table and recreate the
-$opt_database database ! All privileges for $user will be destroyed !
+$opt_database database !
+All privileges for $user will be destroyed !
Don\'t run this test if you have done any GRANT commands that you want to keep!
EOF
diff --git a/tests/grant.res b/tests/grant.res
index 7cc08807fd1..37266facc61 100644
--- a/tests/grant.res
+++ b/tests/grant.res
@@ -119,7 +119,7 @@ Error in execute: Access denied for user: 'grant_user@localhost' to database 'gr
drop table grant_test.test
Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
grant ALL PRIVILEGES on grant_test.* to grant_user2@localhost
-Error in execute: Access denied for user: 'grant_user@localhost' (Using password: NO)
+Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
grant ALL PRIVILEGES on grant_test.* to grant_user@localhost WITH GRANT OPTION
Connecting grant_user
insert into grant_test.test values (5,0)
@@ -145,7 +145,9 @@ create table grant_test.test2 (a int not null)
alter table grant_test.test2 add b int
create index dummy on grant_test.test2 (a)
drop table grant_test.test2
-show tables
+show tables from grant_test
+test
+
insert into mysql.user (host,user) values ('error','grant_user',0)
Error in execute: Access denied for user: 'grant_user@localhost' to database 'mysql'
revoke ALL PRIVILEGES on grant_test.* from grant_user@localhost
@@ -239,7 +241,24 @@ grant drop on grant_test.test2 to grant_user@localhost with grant option
grant drop on grant_test.test2 to grant_user@localhost with grant option
grant select on grant_test.test2 to grant_user@localhost with grant option
Error in execute: select command denied to user: 'grant_user@localhost' for table 'test2'
-drop table grant_test.test2
+rename table grant_test.test2 to grant_test.test3
+Error in execute: insert command denied to user: 'grant_user@localhost' for table 'test3'
+grant CREATE,DROP on grant_test.test3 to grant_user@localhost
+rename table grant_test.test2 to grant_test.test3
+Error in execute: insert command denied to user: 'grant_user@localhost' for table 'test3'
+create table grant_test.test3 (a int)
+grant INSERT on grant_test.test3 to grant_user@localhost
+drop table grant_test.test3
+rename table grant_test.test2 to grant_test.test3
+rename table grant_test.test3 to grant_test.test2
+Error in execute: alter command denied to user: 'grant_user@localhost' for table 'test3'
+grant ALTER on grant_test.test3 to grant_user@localhost
+rename table grant_test.test3 to grant_test.test2
+revoke DROP on grant_test.test2 from grant_user@localhost
+rename table grant_test.test2 to grant_test.test3
+drop table if exists grant_test.test2,grant_test.test3
+Error in execute: drop command denied to user: 'grant_user@localhost' for table 'test2'
+drop table if exists grant_test.test2,grant_test.test3
create database grant_test
Error in execute: Access denied for user: 'grant_user@localhost' to database 'grant_test'
drop database grant_test
@@ -248,15 +267,15 @@ flush tables
Error in execute: Access denied for user: 'grant_user@localhost' (Using password: NO)
flush privileges
select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
-localhost grant_test grant_user test2 grant_user@localhost Update,Delete,Create,Drop,Grant,Index,Alter Insert
+localhost grant_test grant_user test2 root@localhost Update,Delete,Create,Grant,Index,Alter Insert
localhost grant_test grant_user test root@localhost Select,Insert,Update,Delete
+localhost grant_test grant_user test3 root@localhost Insert,Create,Drop,Alter
revoke ALL PRIVILEGES on grant_test.test from grant_user@localhost
revoke ALL PRIVILEGES on grant_test.test2 from grant_user@localhost
+revoke ALL PRIVILEGES on grant_test.test3 from grant_user@localhost
revoke GRANT OPTION on grant_test.test2 from grant_user@localhost
select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
-localhost grant_test grant_user test2 root@localhost Grant,Index,Alter
-
select count(a) from test
Error in execute: select command denied to user: 'grant_user@localhost' for table 'test'
delete from grant_test.test where a=2
@@ -284,13 +303,10 @@ select a,A from test
7 7
select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
-localhost grant_test grant_user test2 root@localhost Grant,Index,Alter
localhost grant_test grant_user test root@localhost Delete Select,Update
revoke ALL PRIVILEGES on grant_test.test from grant_user@localhost
select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
-localhost grant_test grant_user test2 root@localhost Grant,Index,Alter
-
revoke GRANT OPTION on grant_test.test from grant_user@localhost
Error in execute: There is no such grant defined for user 'grant_user' on host 'localhost' on table 'test'
grant select(a) on grant_test.test to grant_user@localhost
@@ -328,7 +344,6 @@ Error in execute: select command denied to user: 'grant_user@localhost' for colu
update test set b=3 where b > 0
Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
-localhost grant_test grant_user test2 root@localhost Grant,Index,Alter
localhost grant_test grant_user test root@localhost Select,Insert,Update
select Host, Db, User, Table_name, Column_name, Column_priv from mysql.columns_priv
@@ -337,7 +352,6 @@ localhost grant_test grant_user test a Select
revoke select(a), update (b) on grant_test.test from grant_user@localhost
select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
-localhost grant_test grant_user test2 root@localhost Grant,Index,Alter
localhost grant_test grant_user test root@localhost Insert
select Host, Db, User, Table_name, Column_name, Column_priv from mysql.columns_priv
@@ -355,7 +369,6 @@ insert into test (b) values (9)
update test set b=6 where b > 0
flush privileges
select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
-localhost grant_test grant_user test2 root@localhost Grant,Index,Alter
localhost grant_test grant_user test root@localhost Select,Insert,Update
select Host, Db, User, Table_name, Column_name, Column_priv from mysql.columns_priv
@@ -402,7 +415,6 @@ select * from mysql.db where user = 'grant_user'
localhost grant_test grant_user N Y N N N N N N N N
select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv where user = 'grant_user'
-localhost grant_test grant_user test2 root@localhost Grant,Index,Alter
localhost grant_test grant_user test root@localhost Select,Insert,Update
select Host, Db, User, Table_name, Column_name, Column_priv from mysql.columns_priv where user = 'grant_user'
@@ -418,8 +430,6 @@ select * from mysql.db where user = 'grant_user'
localhost grant_test grant_user N Y N N N N N N N N
select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv where user = 'grant_user'
-localhost grant_test grant_user test2 root@localhost Grant,Index,Alter
-
select Host, Db, User, Table_name, Column_name, Column_priv from mysql.columns_priv where user = 'grant_user'
delete from user where user='grant_user'
flush privileges