mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge neptunus.(none):/home/msvensson/mysql/bug16297/my50-bug16297
into neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint mysql-test/t/grant.test: Auto merged sql/sql_acl.cc: Auto merged mysql-test/r/grant.result: SCCS merged
This commit is contained in:
@ -591,6 +591,7 @@ insert into tables_priv values ('','test_db','mysqltest_1','test_table','test_gr
|
||||
flush privileges;
|
||||
delete from tables_priv where host = '' and user = 'mysqltest_1';
|
||||
flush privileges;
|
||||
use test;
|
||||
set @user123="non-existent";
|
||||
select * from mysql.db where user=@user123;
|
||||
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv
|
||||
@ -621,9 +622,218 @@ show grants for mysqltest_7@;
|
||||
Grants for mysqltest_7@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_7'@'' IDENTIFIED BY PASSWORD '*2FB071A056F9BB745219D9C876814231DAF46517'
|
||||
drop user mysqltest_7@;
|
||||
flush privileges;
|
||||
show grants for mysqltest_7@;
|
||||
ERROR 42000: There is no such grant defined for user 'mysqltest_7' on host ''
|
||||
create table t1 (a int);
|
||||
create table t2 as select * from mysql.user where user='';
|
||||
delete from mysql.user where user='';
|
||||
flush privileges;
|
||||
create user mysqltest_8@'';
|
||||
create user mysqltest_8;
|
||||
create user mysqltest_8@host8;
|
||||
create user mysqltest_8@'';
|
||||
ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@''
|
||||
create user mysqltest_8;
|
||||
ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'%'
|
||||
create user mysqltest_8@host8;
|
||||
ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'host8'
|
||||
select user, QUOTE(host) from mysql.user where user="mysqltest_8";
|
||||
user QUOTE(host)
|
||||
mysqltest_8 ''
|
||||
mysqltest_8 '%'
|
||||
mysqltest_8 'host8'
|
||||
Schema privileges
|
||||
grant select on mysqltest.* to mysqltest_8@'';
|
||||
show grants for mysqltest_8@'';
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@''
|
||||
grant select on mysqltest.* to mysqltest_8@;
|
||||
show grants for mysqltest_8@;
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@''
|
||||
grant select on mysqltest.* to mysqltest_8;
|
||||
show grants for mysqltest_8;
|
||||
Grants for mysqltest_8@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'%'
|
||||
select * from information_schema.schema_privileges
|
||||
where grantee like "'mysqltest_8'%";
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'mysqltest_8'@'%' NULL mysqltest SELECT NO
|
||||
'mysqltest_8'@'' NULL mysqltest SELECT NO
|
||||
select * from t1;
|
||||
a
|
||||
revoke select on mysqltest.* from mysqltest_8@'';
|
||||
revoke select on mysqltest.* from mysqltest_8;
|
||||
show grants for mysqltest_8@'';
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
show grants for mysqltest_8;
|
||||
Grants for mysqltest_8@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
|
||||
select * from information_schema.schema_privileges
|
||||
where grantee like "'mysqltest_8'%";
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@'';
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
show grants for mysqltest_8@;
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
grant select on mysqltest.* to mysqltest_8@'';
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@;
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@''
|
||||
revoke select on mysqltest.* from mysqltest_8@'';
|
||||
flush privileges;
|
||||
Column privileges
|
||||
grant update (a) on t1 to mysqltest_8@'';
|
||||
grant update (a) on t1 to mysqltest_8;
|
||||
show grants for mysqltest_8@'';
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
|
||||
show grants for mysqltest_8;
|
||||
Grants for mysqltest_8@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
|
||||
GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%'
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@'';
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
|
||||
show grants for mysqltest_8;
|
||||
Grants for mysqltest_8@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
|
||||
GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%'
|
||||
select * from information_schema.column_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'mysqltest_8'@'%' NULL test t1 a UPDATE NO
|
||||
'mysqltest_8'@'' NULL test t1 a UPDATE NO
|
||||
select * from t1;
|
||||
a
|
||||
revoke update (a) on t1 from mysqltest_8@'';
|
||||
revoke update (a) on t1 from mysqltest_8;
|
||||
show grants for mysqltest_8@'';
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
show grants for mysqltest_8;
|
||||
Grants for mysqltest_8@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
|
||||
select * from information_schema.column_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@'';
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
show grants for mysqltest_8;
|
||||
Grants for mysqltest_8@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
|
||||
Table privileges
|
||||
grant update on t1 to mysqltest_8@'';
|
||||
grant update on t1 to mysqltest_8;
|
||||
show grants for mysqltest_8@'';
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@''
|
||||
show grants for mysqltest_8;
|
||||
Grants for mysqltest_8@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
|
||||
GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%'
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@'';
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@''
|
||||
show grants for mysqltest_8;
|
||||
Grants for mysqltest_8@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
|
||||
GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%'
|
||||
select * from information_schema.table_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'mysqltest_8'@'%' NULL test t1 UPDATE NO
|
||||
'mysqltest_8'@'' NULL test t1 UPDATE NO
|
||||
select * from t1;
|
||||
a
|
||||
revoke update on t1 from mysqltest_8@'';
|
||||
revoke update on t1 from mysqltest_8;
|
||||
show grants for mysqltest_8@'';
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
show grants for mysqltest_8;
|
||||
Grants for mysqltest_8@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
|
||||
select * from information_schema.table_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@'';
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
show grants for mysqltest_8;
|
||||
Grants for mysqltest_8@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
|
||||
"DROP USER" should clear privileges
|
||||
grant all privileges on mysqltest.* to mysqltest_8@'';
|
||||
grant select on mysqltest.* to mysqltest_8@'';
|
||||
grant update on t1 to mysqltest_8@'';
|
||||
grant update (a) on t1 to mysqltest_8@'';
|
||||
grant all privileges on mysqltest.* to mysqltest_8;
|
||||
show grants for mysqltest_8@'';
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@''
|
||||
GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
|
||||
show grants for mysqltest_8;
|
||||
Grants for mysqltest_8@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
|
||||
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
|
||||
select * from information_schema.user_privileges
|
||||
where grantee like "'mysqltest_8'%";
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'mysqltest_8'@'host8' NULL USAGE NO
|
||||
'mysqltest_8'@'%' NULL USAGE NO
|
||||
'mysqltest_8'@'' NULL USAGE NO
|
||||
select * from t1;
|
||||
a
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@'';
|
||||
Grants for mysqltest_8@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@''
|
||||
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@''
|
||||
GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
|
||||
show grants for mysqltest_8;
|
||||
Grants for mysqltest_8@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
|
||||
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
|
||||
drop user mysqltest_8@'';
|
||||
show grants for mysqltest_8@'';
|
||||
ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host ''
|
||||
show grants for mysqltest_8;
|
||||
Grants for mysqltest_8@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
|
||||
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
|
||||
select * from information_schema.user_privileges
|
||||
where grantee like "'mysqltest_8'%";
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'mysqltest_8'@'host8' NULL USAGE NO
|
||||
'mysqltest_8'@'%' NULL USAGE NO
|
||||
drop user mysqltest_8;
|
||||
connect(localhost,mysqltest_8,,test,MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'mysqltest_8'@'localhost' (using password: NO)
|
||||
show grants for mysqltest_8;
|
||||
ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '%'
|
||||
drop user mysqltest_8@host8;
|
||||
show grants for mysqltest_8@host8;
|
||||
ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host 'host8'
|
||||
insert into mysql.user select * from t2;
|
||||
flush privileges;
|
||||
drop table t2;
|
||||
drop table t1;
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
create table t1(f1 int);
|
||||
|
@ -479,6 +479,7 @@ insert into tables_priv values ('','test_db','mysqltest_1','test_table','test_gr
|
||||
flush privileges;
|
||||
delete from tables_priv where host = '' and user = 'mysqltest_1';
|
||||
flush privileges;
|
||||
use test;
|
||||
|
||||
#
|
||||
# Bug #10892 user variables not auto cast for comparisons
|
||||
@ -507,7 +508,6 @@ create user mysqltest_7@;
|
||||
set password for mysqltest_7@ = password('systpass');
|
||||
show grants for mysqltest_7@;
|
||||
drop user mysqltest_7@;
|
||||
flush privileges; # BUG#16297(flush should be removed when that bug is fixed)
|
||||
--error 1141
|
||||
show grants for mysqltest_7@;
|
||||
|
||||
@ -528,3 +528,145 @@ flush privileges;
|
||||
drop database mysqltest;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #16297 In memory grant tables not flushed when users's hostname is ""
|
||||
#
|
||||
|
||||
create table t1 (a int);
|
||||
|
||||
# Backup anonymous users and remove them. (They get in the way of
|
||||
# the one we test with here otherwise.)
|
||||
create table t2 as select * from mysql.user where user='';
|
||||
delete from mysql.user where user='';
|
||||
flush privileges;
|
||||
|
||||
# Create some users with different hostnames
|
||||
create user mysqltest_8@'';
|
||||
create user mysqltest_8;
|
||||
create user mysqltest_8@host8;
|
||||
|
||||
# Try to create them again
|
||||
--error 1396
|
||||
create user mysqltest_8@'';
|
||||
--error 1396
|
||||
create user mysqltest_8;
|
||||
--error 1396
|
||||
create user mysqltest_8@host8;
|
||||
|
||||
select user, QUOTE(host) from mysql.user where user="mysqltest_8";
|
||||
|
||||
--echo Schema privileges
|
||||
grant select on mysqltest.* to mysqltest_8@'';
|
||||
show grants for mysqltest_8@'';
|
||||
grant select on mysqltest.* to mysqltest_8@;
|
||||
show grants for mysqltest_8@;
|
||||
grant select on mysqltest.* to mysqltest_8;
|
||||
show grants for mysqltest_8;
|
||||
select * from information_schema.schema_privileges
|
||||
where grantee like "'mysqltest_8'%";
|
||||
connect (conn3,localhost,mysqltest_8,,);
|
||||
select * from t1;
|
||||
disconnect conn3;
|
||||
connection master;
|
||||
revoke select on mysqltest.* from mysqltest_8@'';
|
||||
revoke select on mysqltest.* from mysqltest_8;
|
||||
show grants for mysqltest_8@'';
|
||||
show grants for mysqltest_8;
|
||||
select * from information_schema.schema_privileges
|
||||
where grantee like "'mysqltest_8'%";
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@'';
|
||||
show grants for mysqltest_8@;
|
||||
grant select on mysqltest.* to mysqltest_8@'';
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@;
|
||||
revoke select on mysqltest.* from mysqltest_8@'';
|
||||
flush privileges;
|
||||
|
||||
--echo Column privileges
|
||||
grant update (a) on t1 to mysqltest_8@'';
|
||||
grant update (a) on t1 to mysqltest_8;
|
||||
show grants for mysqltest_8@'';
|
||||
show grants for mysqltest_8;
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@'';
|
||||
show grants for mysqltest_8;
|
||||
select * from information_schema.column_privileges;
|
||||
connect (conn4,localhost,mysqltest_8,,);
|
||||
select * from t1;
|
||||
disconnect conn4;
|
||||
connection master;
|
||||
revoke update (a) on t1 from mysqltest_8@'';
|
||||
revoke update (a) on t1 from mysqltest_8;
|
||||
show grants for mysqltest_8@'';
|
||||
show grants for mysqltest_8;
|
||||
select * from information_schema.column_privileges;
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@'';
|
||||
show grants for mysqltest_8;
|
||||
|
||||
--echo Table privileges
|
||||
grant update on t1 to mysqltest_8@'';
|
||||
grant update on t1 to mysqltest_8;
|
||||
show grants for mysqltest_8@'';
|
||||
show grants for mysqltest_8;
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@'';
|
||||
show grants for mysqltest_8;
|
||||
select * from information_schema.table_privileges;
|
||||
connect (conn5,localhost,mysqltest_8,,);
|
||||
select * from t1;
|
||||
disconnect conn5;
|
||||
connection master;
|
||||
revoke update on t1 from mysqltest_8@'';
|
||||
revoke update on t1 from mysqltest_8;
|
||||
show grants for mysqltest_8@'';
|
||||
show grants for mysqltest_8;
|
||||
select * from information_schema.table_privileges;
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@'';
|
||||
show grants for mysqltest_8;
|
||||
|
||||
--echo "DROP USER" should clear privileges
|
||||
grant all privileges on mysqltest.* to mysqltest_8@'';
|
||||
grant select on mysqltest.* to mysqltest_8@'';
|
||||
grant update on t1 to mysqltest_8@'';
|
||||
grant update (a) on t1 to mysqltest_8@'';
|
||||
grant all privileges on mysqltest.* to mysqltest_8;
|
||||
show grants for mysqltest_8@'';
|
||||
show grants for mysqltest_8;
|
||||
select * from information_schema.user_privileges
|
||||
where grantee like "'mysqltest_8'%";
|
||||
connect (conn5,localhost,mysqltest_8,,);
|
||||
select * from t1;
|
||||
disconnect conn5;
|
||||
connection master;
|
||||
flush privileges;
|
||||
show grants for mysqltest_8@'';
|
||||
show grants for mysqltest_8;
|
||||
drop user mysqltest_8@'';
|
||||
--error 1141
|
||||
show grants for mysqltest_8@'';
|
||||
show grants for mysqltest_8;
|
||||
select * from information_schema.user_privileges
|
||||
where grantee like "'mysqltest_8'%";
|
||||
drop user mysqltest_8;
|
||||
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
|
||||
--error 1045
|
||||
connect (conn6,localhost,mysqltest_8,,);
|
||||
connection master;
|
||||
--error 1141
|
||||
show grants for mysqltest_8;
|
||||
drop user mysqltest_8@host8;
|
||||
--error 1141
|
||||
show grants for mysqltest_8@host8;
|
||||
|
||||
# Restore the anonymous users.
|
||||
insert into mysql.user select * from t2;
|
||||
flush privileges;
|
||||
drop table t2;
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user