mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
merge 5.1-5.1.29-rc to B38701 working tree
This commit is contained in:
@@ -136,7 +136,7 @@ connect (user3,localhost,mysqltest_3,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection user3;
|
||||
select "user3";
|
||||
--replace_result 127.0.0.1 localhost
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
select * from t1;
|
||||
select a from t1;
|
||||
--replace_result 127.0.0.1 localhost
|
||||
|
@@ -1559,6 +1559,17 @@ SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 c1 1 c1 A NULL NULL NULL YES BTREE
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INTEGER AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL);
|
||||
INSERT IGNORE INTO t1 (b) VALUES (5);
|
||||
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
|
||||
SELECT a FROM t1;
|
||||
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
|
||||
SELECT a FROM t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
|
||||
SELECT a FROM t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
insert into t1 values (1,1),(1,2);
|
||||
|
@@ -114,6 +114,18 @@ End of 4.1 tests
|
||||
SELECT 1 REGEXP NULL;
|
||||
1 REGEXP NULL
|
||||
NULL
|
||||
SELECT '' REGEXP BINARY NULL;
|
||||
'' REGEXP BINARY NULL
|
||||
NULL
|
||||
SELECT NULL REGEXP BINARY NULL;
|
||||
NULL REGEXP BINARY NULL
|
||||
NULL
|
||||
SELECT 'A' REGEXP BINARY NULL;
|
||||
'A' REGEXP BINARY NULL
|
||||
NULL
|
||||
SELECT "ABC" REGEXP BINARY NULL;
|
||||
"ABC" REGEXP BINARY NULL
|
||||
NULL
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1(a INT, b CHAR(4));
|
||||
INSERT INTO t1 VALUES (1, '6.1'), (1, '7.0'), (1, '8.0');
|
||||
|
@@ -434,7 +434,7 @@ USE db1;
|
||||
SELECT c FROM t2;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
|
||||
SELECT * FROM t2;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for table 't2'
|
||||
SELECT * FROM t1 JOIN t2 USING (b);
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
|
||||
DROP TABLE db1.t1, db1.t2;
|
||||
|
@@ -155,7 +155,7 @@ select "user3";
|
||||
user3
|
||||
user3
|
||||
select * from t1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
|
||||
select a from t1;
|
||||
a
|
||||
1
|
||||
|
@@ -155,7 +155,7 @@ select "user3";
|
||||
user3
|
||||
user3
|
||||
select * from t1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
|
||||
select a from t1;
|
||||
a
|
||||
1
|
||||
|
@@ -957,3 +957,35 @@ Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests.
|
||||
CREATE USER mysqluser1@localhost;
|
||||
CREATE DATABASE mysqltest1;
|
||||
USE mysqltest1;
|
||||
CREATE TABLE t1 ( a INT, b INT );
|
||||
CREATE TABLE t2 ( a INT, b INT );
|
||||
CREATE VIEW v1 AS SELECT a, b FROM t1;
|
||||
GRANT SELECT( a ) ON v1 TO mysqluser1@localhost;
|
||||
GRANT UPDATE( b ) ON t2 TO mysqluser1@localhost;
|
||||
SELECT * FROM mysqltest1.v1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1'
|
||||
CREATE VIEW v1 AS SELECT * FROM mysqltest1.t2;
|
||||
ERROR 42000: ANY command denied to user 'mysqluser1'@'localhost' for table 't2'
|
||||
DROP TABLE t1, t2;
|
||||
DROP VIEW v1;
|
||||
DROP DATABASE mysqltest1;
|
||||
DROP USER mysqluser1@localhost;
|
||||
CREATE USER mysqluser1@localhost;
|
||||
CREATE DATABASE mysqltest1;
|
||||
USE mysqltest1;
|
||||
CREATE VIEW v1 AS SELECT * FROM information_schema.tables LIMIT 1;
|
||||
CREATE ALGORITHM = TEMPTABLE VIEW v2 AS SELECT 1 AS A;
|
||||
GRANT SELECT ON mysqltest1.* to mysqluser1@localhost;
|
||||
PREPARE stmt_v1 FROM "SELECT * FROM mysqltest1.v1";
|
||||
PREPARE stmt_v2 FROM "SELECT * FROM mysqltest1.v2";
|
||||
REVOKE SELECT ON mysqltest1.* FROM mysqluser1@localhost;
|
||||
EXECUTE stmt_v1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1'
|
||||
EXECUTE stmt_v2;
|
||||
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v2'
|
||||
DROP VIEW v1, v2;
|
||||
DROP DATABASE mysqltest1;
|
||||
DROP USER mysqluser1@localhost;
|
||||
|
@@ -1176,6 +1176,24 @@ SHOW INDEX FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#38821: Assert table->auto_increment_field_not_null failed in open_table()
|
||||
#
|
||||
CREATE TABLE t1 (a INTEGER AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL);
|
||||
INSERT IGNORE INTO t1 (b) VALUES (5);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
|
||||
SELECT a FROM t1;
|
||||
--error 1062
|
||||
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
|
||||
SELECT a FROM t1;
|
||||
--error 1062
|
||||
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
|
||||
SELECT a FROM t1;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
|
@@ -64,6 +64,16 @@ drop table t1;
|
||||
|
||||
SELECT 1 REGEXP NULL;
|
||||
|
||||
|
||||
#
|
||||
# Bug #39021: SELECT REGEXP BINARY NULL never returns
|
||||
#
|
||||
|
||||
SELECT '' REGEXP BINARY NULL;
|
||||
SELECT NULL REGEXP BINARY NULL;
|
||||
SELECT 'A' REGEXP BINARY NULL;
|
||||
SELECT "ABC" REGEXP BINARY NULL;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
||||
|
@@ -605,7 +605,7 @@ connection conn1;
|
||||
USE db1;
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
SELECT c FROM t2;
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
SELECT * FROM t2;
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
SELECT * FROM t1 JOIN t2 USING (b);
|
||||
|
@@ -1219,3 +1219,71 @@ DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests.
|
||||
|
||||
#
|
||||
# Bug#36086: SELECT * from views don't check column grants
|
||||
#
|
||||
CREATE USER mysqluser1@localhost;
|
||||
CREATE DATABASE mysqltest1;
|
||||
|
||||
USE mysqltest1;
|
||||
|
||||
CREATE TABLE t1 ( a INT, b INT );
|
||||
CREATE TABLE t2 ( a INT, b INT );
|
||||
|
||||
CREATE VIEW v1 AS SELECT a, b FROM t1;
|
||||
|
||||
GRANT SELECT( a ) ON v1 TO mysqluser1@localhost;
|
||||
GRANT UPDATE( b ) ON t2 TO mysqluser1@localhost;
|
||||
|
||||
--connect (connection1, localhost, mysqluser1, , test)
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
SELECT * FROM mysqltest1.v1;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
CREATE VIEW v1 AS SELECT * FROM mysqltest1.t2;
|
||||
|
||||
--disconnect connection1
|
||||
|
||||
--connection default
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
DROP VIEW v1;
|
||||
DROP DATABASE mysqltest1;
|
||||
DROP USER mysqluser1@localhost;
|
||||
|
||||
#
|
||||
# Bug#35600: Security breach via view, I_S table and prepared
|
||||
# statement/stored procedure
|
||||
#
|
||||
CREATE USER mysqluser1@localhost;
|
||||
CREATE DATABASE mysqltest1;
|
||||
|
||||
USE mysqltest1;
|
||||
|
||||
CREATE VIEW v1 AS SELECT * FROM information_schema.tables LIMIT 1;
|
||||
CREATE ALGORITHM = TEMPTABLE VIEW v2 AS SELECT 1 AS A;
|
||||
|
||||
--connection default
|
||||
GRANT SELECT ON mysqltest1.* to mysqluser1@localhost;
|
||||
|
||||
--connect (connection1, localhost, mysqluser1, , test)
|
||||
PREPARE stmt_v1 FROM "SELECT * FROM mysqltest1.v1";
|
||||
PREPARE stmt_v2 FROM "SELECT * FROM mysqltest1.v2";
|
||||
|
||||
--connection default
|
||||
REVOKE SELECT ON mysqltest1.* FROM mysqluser1@localhost;
|
||||
|
||||
--connection connection1
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
EXECUTE stmt_v1;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
EXECUTE stmt_v2;
|
||||
|
||||
--disconnect connection1
|
||||
--connection default
|
||||
DROP VIEW v1, v2;
|
||||
DROP DATABASE mysqltest1;
|
||||
DROP USER mysqluser1@localhost;
|
||||
|
Reference in New Issue
Block a user