mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
Merge Bug#7391 from 4.0
mysql-test/r/update.result: Auto merged mysql-test/t/update.test: Auto merged sql/sql_select.cc: Auto merged mysql-test/mysql-test-run.sh: Merge from 4.0
This commit is contained in:
commit
02453262bc
5 changed files with 158 additions and 11 deletions
|
|
@ -5,6 +5,8 @@
|
|||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
connect (master,localhost,root,,);
|
||||
connection master;
|
||||
SET NAMES binary;
|
||||
|
||||
#
|
||||
|
|
@ -280,3 +282,73 @@ show grants for grant_user@localhost;
|
|||
select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
|
||||
drop user grant_user@localhost;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#7391: Cross-database multi-table UPDATE security problem
|
||||
#
|
||||
create database mysqltest_1;
|
||||
create database mysqltest_2;
|
||||
create table mysqltest_1.t1 select 1 a, 2 q;
|
||||
create table mysqltest_1.t2 select 1 b, 2 r;
|
||||
create table mysqltest_2.t1 select 1 c, 2 s;
|
||||
create table mysqltest_2.t2 select 1 d, 2 t;
|
||||
|
||||
#test the column privileges
|
||||
grant update (a) on mysqltest_1.t1 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 (d) on mysqltest_2.t2 to mysqltest_3@localhost;
|
||||
connect (conn1,localhost,mysqltest_3,,);
|
||||
connection conn1;
|
||||
show grants for mysqltest_3@localhost;
|
||||
--error 1143
|
||||
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
|
||||
--error 1143
|
||||
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
|
||||
--error 1143
|
||||
update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
|
||||
--error 1143
|
||||
update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
|
||||
#the following two should work
|
||||
update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10;
|
||||
update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20;
|
||||
connection master;
|
||||
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
|
||||
select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2;
|
||||
revoke all on mysqltest_1.t1 from mysqltest_3@localhost;
|
||||
revoke all on mysqltest_1.t2 from mysqltest_3@localhost;
|
||||
revoke all on mysqltest_2.t1 from mysqltest_3@localhost;
|
||||
revoke all on mysqltest_2.t2 from mysqltest_3@localhost;
|
||||
|
||||
#test the db/table level privileges
|
||||
grant all on mysqltest_2.* to mysqltest_3@localhost;
|
||||
grant select on *.* to mysqltest_3@localhost;
|
||||
flush privileges;
|
||||
disconnect conn1;
|
||||
connect (conn2,localhost,mysqltest_3,,);
|
||||
connection conn2;
|
||||
use mysqltest_1;
|
||||
update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
|
||||
# the following failed before, should fail now.
|
||||
--error 1143
|
||||
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
|
||||
use mysqltest_2;
|
||||
#the following used to succeed, it must fail now.
|
||||
--error 1044
|
||||
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
|
||||
--error 1044
|
||||
update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
|
||||
--error 1044
|
||||
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
|
||||
#lets see the result
|
||||
connection master;
|
||||
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
|
||||
select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2;
|
||||
|
||||
delete from mysql.user where user='mysqltest_3';
|
||||
delete from mysql.db where user="mysqltest_3";
|
||||
delete from mysql.tables_priv where user="mysqltest_3";
|
||||
delete from mysql.columns_priv where user="mysqltest_3";
|
||||
flush privileges;
|
||||
drop database mysqltest_1;
|
||||
drop database mysqltest_2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue