From 10cd77ed8493bba09e5b901f8895d7a66b37bf94 Mon Sep 17 00:00:00 2001 From: unknown <monty@mashka.mysql.fi> Date: Thu, 8 May 2003 01:47:20 +0300 Subject: [PATCH] More tests --- tests/grant.pl | 10 ++++++++-- tests/grant.res | 18 ++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/tests/grant.pl b/tests/grant.pl index fb73be786b6..3146b7b6c25 100644 --- a/tests/grant.pl +++ b/tests/grant.pl @@ -82,6 +82,7 @@ user_query("select * from mysql.user where user = '$opt_user'"); user_query("select * from mysql.db where user = '$opt_user'"); safe_query("grant select on *.* to $user,$user"); safe_query("show grants for $user"); +user_connect(0); # The following should fail user_query("insert into mysql.user (host,user) values ('error','$opt_user')",1); @@ -95,16 +96,21 @@ safe_query("grant select on $opt_database.not_exists to $opt_user",1); safe_query("grant FILE on $opt_database.test to $opt_user",1); safe_query("grant select on *.* to wrong___________user_name",1); safe_query("grant select on $opt_database.* to wrong___________user_name",1); +user_connect(0); user_query("grant select on $opt_database.test to $opt_user with grant option",1); safe_query("set password FOR ''\@''=''",1); user_query("set password FOR root\@$opt_host = password('test')",1); # Change privileges for user safe_query("revoke select on *.* from $user"); -safe_query("grant create on *.* to $user"); +safe_query("grant create,update on *.* to $user"); user_connect(0); +safe_query("flush privileges"); user_query("create table $opt_database.test (a int,b int)"); - +user_query("update $opt_database.test set b=b+1 where a > 0",1); +safe_query("show grants for $user"); +safe_query("revoke update on *.* from $user"); +user_connect(0); safe_query("grant select(c) on $opt_database.test to $user",1); safe_query("revoke select(c) on $opt_database.test from $user",1); safe_query("grant select on $opt_database.test to wrong___________user_name",1); diff --git a/tests/grant.res b/tests/grant.res index 7947ca692b6..f208241d989 100644 --- a/tests/grant.res +++ b/tests/grant.res @@ -28,6 +28,7 @@ grant select on *.* to grant_user@localhost,grant_user@localhost show grants for grant_user@localhost GRANT SELECT ON *.* TO 'grant_user'@'localhost' +Connecting grant_user insert into mysql.user (host,user) values ('error','grant_user') Error in execute: insert command denied to user: 'grant_user@localhost' for table 'user' update mysql.user set host='error' WHERE user='grant_user' @@ -50,6 +51,7 @@ grant select on *.* to wrong___________user_name Error in execute: The host or user argument to GRANT is too long grant select on grant_test.* to wrong___________user_name Error in execute: The host or user argument to GRANT is too long +Connecting grant_user grant select on grant_test.test to grant_user with grant option Error in execute: grant command denied to user: 'grant_user@localhost' for table 'test' set password FOR ''@''='' @@ -57,9 +59,17 @@ Error in execute: Can't find any matching row in the user table set password FOR root@localhost = password('test') Error in execute: Access denied for user: 'grant_user@localhost' to database 'mysql' revoke select on *.* from grant_user@localhost -grant create on *.* to grant_user@localhost +grant create,update on *.* to grant_user@localhost Connecting grant_user +flush privileges create table grant_test.test (a int,b int) +update grant_test.test set b=b+1 where a > 0 +Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'a' in table 'test' +show grants for grant_user@localhost +GRANT UPDATE, CREATE ON *.* TO 'grant_user'@'localhost' + +revoke update on *.* from grant_user@localhost +Connecting grant_user grant select(c) on grant_test.test to grant_user@localhost Error in execute: Unknown column 'c' in 'test' revoke select(c) on grant_test.test from grant_user@localhost @@ -214,9 +224,9 @@ revoke UPDATE on *.* from grant_user@localhost revoke SELECT on grant_test.* from grant_user@localhost Connecting grant_user update grant_test.test set b=b+1 where a > 0 -Error in execute: select command denied to user: 'grant_user@localhost' for column 'a' in table 'test' +Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'a' in table 'test' update grant_test.test set b=b+1 -Error in execute: select command denied to user: 'grant_user@localhost' for column 'b' in table 'test' +Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test' select * from test Error in execute: select command denied to user: 'grant_user@localhost' for table 'test' grant select on grant_test.test to grant_user@localhost @@ -504,7 +514,7 @@ Error in execute: Access denied for user: 'grant_user@localhost' to database 'gr grant LOCK TABLES on *.* to grant_user@localhost show grants for grant_user@localhost GRANT LOCK TABLES ON *.* TO 'grant_user'@'localhost' -GRANT SELECT, INSERT ON grant_test.test3 TO 'grant_user'@'localhost' +GRANT SELECT, INSERT ON `grant_test`.`test3` TO 'grant_user'@'localhost' select * from mysql.user where user='grant_user' 127.0.0.1 grant_user 7f70e8b858ee6782 N N N N N N N N N N N N N N N N N N N N N 0 0 0 -- 2.30.9