mirror of
https://github.com/MariaDB/server.git
synced 2025-08-31 22:22:30 +03:00
After merge fixes
This commit is contained in:
@@ -134,6 +134,31 @@ ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
|
||||
select 1;
|
||||
1
|
||||
1
|
||||
insert into mysql.user (host, user) values ('localhost', 'test11');
|
||||
insert into mysql.db (host, db, user, select_priv) values
|
||||
('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
|
||||
alter table mysql.db order by db asc;
|
||||
flush privileges;
|
||||
show grants for test11@localhost;
|
||||
Grants for test11@localhost
|
||||
GRANT USAGE ON *.* TO 'test11'@'localhost'
|
||||
GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
|
||||
GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
|
||||
alter table mysql.db order by db desc;
|
||||
flush privileges;
|
||||
show grants for test11@localhost;
|
||||
Grants for test11@localhost
|
||||
GRANT USAGE ON *.* TO 'test11'@'localhost'
|
||||
GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
|
||||
GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
|
||||
delete from mysql.user where user='test11';
|
||||
delete from mysql.db where user='test11';
|
||||
create database mysqltest1;
|
||||
grant usage on mysqltest1.* to test6123 identified by 'magic123';
|
||||
select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
|
||||
host db user select_priv insert_priv
|
||||
delete from mysql.user where user='test6123';
|
||||
drop database mysqltest1;
|
||||
create table t1 (a int);
|
||||
grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
|
||||
show grants for drop_user2@localhost;
|
||||
@@ -229,31 +254,6 @@ GRANT SELECT (
|
||||
REVOKE SELECT (<28><><EFBFBD>) ON <20><>.<2E><><EFBFBD> FROM <20><><EFBFBD><EFBFBD>@localhost;
|
||||
DROP DATABASE <20><>;
|
||||
SET NAMES latin1;
|
||||
insert into mysql.user (host, user) values ('localhost', 'test11');
|
||||
insert into mysql.db (host, db, user, select_priv) values
|
||||
('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
|
||||
alter table mysql.db order by db asc;
|
||||
flush privileges;
|
||||
show grants for test11@localhost;
|
||||
Grants for test11@localhost
|
||||
GRANT USAGE ON *.* TO 'test11'@'localhost'
|
||||
GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
|
||||
GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
|
||||
alter table mysql.db order by db desc;
|
||||
flush privileges;
|
||||
show grants for test11@localhost;
|
||||
Grants for test11@localhost
|
||||
GRANT USAGE ON *.* TO 'test11'@'localhost'
|
||||
GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
|
||||
GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
|
||||
delete from mysql.user where user='test11';
|
||||
delete from mysql.db where user='test11';
|
||||
create database db6123;
|
||||
grant usage on db6123.* to test6123 identified by 'magic123';
|
||||
select host,db,user,select_priv,insert_priv from mysql.db where db="db6123";
|
||||
host db user select_priv insert_priv
|
||||
delete from mysql.user where user='test6123';
|
||||
drop database db6123;
|
||||
USE test;
|
||||
CREATE TABLE t1 (a int );
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
|
@@ -194,7 +194,7 @@ select (@before:=unix_timestamp())*0;
|
||||
begin;
|
||||
select * from t1 for update;
|
||||
insert into t2 values (20);
|
||||
Lock wait timeout exceeded; Try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select (@after:=unix_timestamp())*0;
|
||||
(@after:=unix_timestamp())*0
|
||||
0
|
||||
|
@@ -1,4 +1,5 @@
|
||||
use test;
|
||||
drop table if exists t5, t6, t7, t8;
|
||||
drop database if exists mysqltest ;
|
||||
test_sequence
|
||||
------ basic tests ------
|
||||
drop table if exists t1, t9 ;
|
||||
@@ -558,7 +559,6 @@ execute stmt3;
|
||||
ERROR 42S01: Table 'new_t2' already exists
|
||||
rename table new_t2 to t2;
|
||||
drop table t2;
|
||||
drop table if exists t5, t6, t7, t8 ;
|
||||
prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
|
||||
create table t5 (a int) ;
|
||||
execute stmt1 ;
|
||||
@@ -810,21 +810,24 @@ test_sequence
|
||||
------ grant/revoke/drop affects a parallel session test ------
|
||||
show grants for second_user@localhost ;
|
||||
ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
|
||||
grant usage on test.* to second_user@localhost
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
use test;
|
||||
grant usage on mysqltest.* to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
grant select on test.t9 to second_user@localhost
|
||||
grant select on mysqltest.t9 to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
Grants for second_user@localhost
|
||||
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
|
||||
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
|
||||
select current_user();
|
||||
current_user()
|
||||
second_user@localhost
|
||||
show grants for current_user();
|
||||
Grants for second_user@localhost
|
||||
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
|
||||
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
|
||||
prepare s_t9 from 'select c1 as my_col
|
||||
from t9 where c1= 1' ;
|
||||
execute s_t9 ;
|
||||
@@ -832,24 +835,24 @@ my_col
|
||||
1
|
||||
select a as my_col from t1;
|
||||
ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
|
||||
grant select on test.t1 to second_user@localhost
|
||||
grant select on mysqltest.t1 to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
Grants for second_user@localhost
|
||||
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
|
||||
GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
|
||||
drop table t9 ;
|
||||
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
|
||||
drop table mysqltest.t9 ;
|
||||
show grants for second_user@localhost ;
|
||||
Grants for second_user@localhost
|
||||
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
|
||||
GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
|
||||
show grants for second_user@localhost ;
|
||||
Grants for second_user@localhost
|
||||
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
|
||||
GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
|
||||
prepare s_t1 from 'select a as my_col from t1' ;
|
||||
execute s_t1 ;
|
||||
my_col
|
||||
@@ -858,17 +861,17 @@ my_col
|
||||
3
|
||||
4
|
||||
execute s_t9 ;
|
||||
ERROR 42S02: Table 'test.t9' doesn't exist
|
||||
revoke all privileges on test.t1 from second_user@localhost
|
||||
ERROR 42S02: Table 'mysqltest.t9' doesn't exist
|
||||
revoke all privileges on mysqltest.t1 from second_user@localhost
|
||||
identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
Grants for second_user@localhost
|
||||
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
|
||||
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
|
||||
show grants for second_user@localhost ;
|
||||
Grants for second_user@localhost
|
||||
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
|
||||
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
|
||||
execute s_t1 ;
|
||||
ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
|
||||
revoke all privileges, grant option from second_user@localhost ;
|
||||
@@ -879,4 +882,5 @@ drop user second_user@localhost ;
|
||||
commit ;
|
||||
show grants for second_user@localhost ;
|
||||
ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
|
||||
drop table t1 ;
|
||||
drop table t1,t9 ;
|
||||
drop database mysqltest;
|
||||
|
@@ -36,6 +36,6 @@ create table t1 (ts timestamp);
|
||||
insert into t1 values (19730101235900), (20040101235900);
|
||||
select * from t1;
|
||||
ts
|
||||
19730101235900
|
||||
20040101235900
|
||||
1973-01-01 23:59:00
|
||||
2004-01-01 23:59:00
|
||||
drop table t1;
|
||||
|
@@ -8,7 +8,11 @@
|
||||
# NOTE: PLEASE SEE THE DETAILED DESCRIPTION AT THE BOTTOM OF THIS FILE
|
||||
# BEFORE ADDING NEW TEST CASES HERE !!!
|
||||
|
||||
use test;
|
||||
--disable_warnings
|
||||
drop table if exists t5, t6, t7, t8;
|
||||
drop database if exists mysqltest ;
|
||||
--enable_warnings
|
||||
|
||||
--disable_query_log
|
||||
select '------ basic tests ------' as test_sequence ;
|
||||
--enable_query_log
|
||||
@@ -590,12 +594,9 @@ rename table new_t2 to t2;
|
||||
drop table t2;
|
||||
## RENAME more than on TABLE within one statement
|
||||
# cases derived from client_test.c: test_rename()
|
||||
--disable_warnings
|
||||
drop table if exists t5, t6, t7, t8 ;
|
||||
--enable_warnings
|
||||
prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
|
||||
create table t5 (a int) ;
|
||||
# rename must fail, tc does not exist
|
||||
# rename must fail, t7 does not exist
|
||||
--error 1017
|
||||
execute stmt1 ;
|
||||
create table t7 (a int) ;
|
||||
@@ -864,15 +865,23 @@ select '------ grant/revoke/drop affects a parallel session test ------'
|
||||
--error 1141
|
||||
show grants for second_user@localhost ;
|
||||
## create a new user account by using GRANT statements on t9
|
||||
grant usage on test.* to second_user@localhost
|
||||
create database mysqltest;
|
||||
# create the tables (t1 and t9) used in many tests
|
||||
use mysqltest;
|
||||
--disable_query_log
|
||||
--source include/ps_create.inc
|
||||
--source include/ps_renew.inc
|
||||
--enable_query_log
|
||||
eval use $DB;
|
||||
grant usage on mysqltest.* to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
grant select on test.t9 to second_user@localhost
|
||||
grant select on mysqltest.t9 to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
|
||||
|
||||
#### establish a second session to the new user account
|
||||
connect (con3,localhost,second_user,looser,test);
|
||||
connect (con3,localhost,second_user,looser,mysqltest);
|
||||
## switch to the second session
|
||||
connection con3;
|
||||
# Who am I ?
|
||||
@@ -890,10 +899,10 @@ select a as my_col from t1;
|
||||
#### give access rights to t1 and drop table t9
|
||||
## switch back to the first session
|
||||
connection default;
|
||||
grant select on test.t1 to second_user@localhost
|
||||
grant select on mysqltest.t1 to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
drop table t9 ;
|
||||
drop table mysqltest.t9 ;
|
||||
show grants for second_user@localhost ;
|
||||
|
||||
|
||||
@@ -912,7 +921,7 @@ execute s_t9 ;
|
||||
#### revoke the access rights to t1
|
||||
## switch back to the first session
|
||||
connection default;
|
||||
revoke all privileges on test.t1 from second_user@localhost
|
||||
revoke all privileges on mysqltest.t1 from second_user@localhost
|
||||
identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
|
||||
@@ -937,8 +946,8 @@ commit ;
|
||||
--error 1141
|
||||
show grants for second_user@localhost ;
|
||||
|
||||
|
||||
drop table t1 ;
|
||||
drop table t1,t9 ;
|
||||
drop database mysqltest;
|
||||
|
||||
|
||||
##### RULES OF THUMB TO PRESERVE THE SYSTEMATICS OF THE PS TEST CASES #####
|
||||
|
Reference in New Issue
Block a user