Commit a2e5a9f9 authored by unknown's avatar unknown

Bug#14406 GRANTS ON objects with non-ascii names borked after FLUSH PRIVILEGES

ps_grant.result:
  Fixing result order.
grant.result:
  Adding test case,
  fixing result order.
grant.test:
  Adding test case.
sql_acl.cc:
  Fixed that my_charset_latin1 was incorrectly used instead of system_charset_info.
  This problem was previously fixed by Ingo in 5.0.
  This patch is basically a backport of the same changes into 4.1.


sql/sql_acl.cc:
  Bug#14406 GRANTS ON objects with non-ascii names borked after FLUSH PRIVILEGES
  Fixed that my_charset_latin1 was incorrectly used instead of system_charset_info.
  This problem was previously fixed by Ingo in 5.0.
  This patch is basically a backport of the same changes into 4.1.
mysql-test/t/grant.test:
  Adding test case.
mysql-test/r/grant.result:
  Adding test case,
  fixing result order.
mysql-test/r/ps_grant.result:
  Fixing result order.
parent cde1be69
...@@ -351,10 +351,10 @@ GRANT USAGE ON *.* TO 'grant_user'@'localhost' ...@@ -351,10 +351,10 @@ GRANT USAGE ON *.* TO 'grant_user'@'localhost'
GRANT INSERT (a, d, c, b) ON `test`.`t1` TO 'grant_user'@'localhost' GRANT INSERT (a, d, c, b) ON `test`.`t1` TO 'grant_user'@'localhost'
select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv; select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
Host Db User Table_name Column_name Column_priv Host Db User Table_name Column_name Column_priv
localhost test grant_user t1 c Insert
localhost test grant_user t1 b Insert localhost test grant_user t1 b Insert
localhost test grant_user t1 a Insert
localhost test grant_user t1 d Insert localhost test grant_user t1 d Insert
localhost test grant_user t1 a Insert
localhost test grant_user t1 c Insert
revoke ALL PRIVILEGES on t1 from grant_user@localhost; revoke ALL PRIVILEGES on t1 from grant_user@localhost;
show grants for grant_user@localhost; show grants for grant_user@localhost;
Grants for grant_user@localhost Grants for grant_user@localhost
...@@ -377,9 +377,9 @@ show grants for mysqltest_3@localhost; ...@@ -377,9 +377,9 @@ show grants for mysqltest_3@localhost;
Grants for mysqltest_3@localhost Grants for mysqltest_3@localhost
GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost' GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
GRANT SELECT (b) ON `mysqltest_1`.`t2` TO 'mysqltest_3'@'localhost' GRANT SELECT (b) ON `mysqltest_1`.`t2` TO 'mysqltest_3'@'localhost'
GRANT SELECT (c) ON `mysqltest_2`.`t1` TO 'mysqltest_3'@'localhost'
GRANT UPDATE (a) ON `mysqltest_1`.`t1` TO 'mysqltest_3'@'localhost' GRANT UPDATE (a) ON `mysqltest_1`.`t1` TO 'mysqltest_3'@'localhost'
GRANT UPDATE (d) ON `mysqltest_2`.`t2` TO 'mysqltest_3'@'localhost' GRANT UPDATE (d) ON `mysqltest_2`.`t2` TO 'mysqltest_3'@'localhost'
GRANT SELECT (c) ON `mysqltest_2`.`t1` TO 'mysqltest_3'@'localhost'
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1; update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'q' in table 't1' ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'q' in table 't1'
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1; update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
...@@ -443,3 +443,24 @@ flush privileges; ...@@ -443,3 +443,24 @@ flush privileges;
set @user123="non-existent"; set @user123="non-existent";
select * from mysql.db where user=@user123; 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 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
set names koi8r;
create database ;
grant select on .* to root@localhost;
select hex(Db) from mysql.db where Db='';
hex(Db)
D0B1D0B4
show grants for root@localhost;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT SELECT ON ``.* TO 'root'@'localhost'
flush privileges;
show grants for root@localhost;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT SELECT ON ``.* TO 'root'@'localhost'
drop database ;
revoke all privileges on .* from root@localhost;
show grants for root@localhost;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
set names latin1;
...@@ -32,19 +32,19 @@ identified by 'looser' ; ...@@ -32,19 +32,19 @@ identified by 'looser' ;
show grants for second_user@localhost ; show grants for second_user@localhost ;
Grants for second_user@localhost Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3' GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost' GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
drop table mysqltest.t9 ; drop table mysqltest.t9 ;
show grants for second_user@localhost ; show grants for second_user@localhost ;
Grants for second_user@localhost Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3' GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost' GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
show grants for second_user@localhost ; show grants for second_user@localhost ;
Grants for second_user@localhost Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3' GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost' GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
prepare s_t1 from 'select a as my_col from t1' ; prepare s_t1 from 'select a as my_col from t1' ;
execute s_t1 ; execute s_t1 ;
my_col my_col
......
...@@ -409,4 +409,16 @@ flush privileges; ...@@ -409,4 +409,16 @@ flush privileges;
set @user123="non-existent"; set @user123="non-existent";
select * from mysql.db where user=@user123; select * from mysql.db where user=@user123;
set names koi8r;
create database ;
grant select on .* to root@localhost;
select hex(Db) from mysql.db where Db='';
show grants for root@localhost;
flush privileges;
show grants for root@localhost;
drop database ;
revoke all privileges on .* from root@localhost;
show grants for root@localhost;
set names latin1;
# End of 4.1 tests # End of 4.1 tests
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment