Commit d12e1c92 authored by Alexander Barkov's avatar Alexander Barkov

Adding security tests for "ALTER TABLE t1 FILE_NAME='xxx'"

modified:
  mysql-test/suite/connect/r/bin.result
  mysql-test/suite/connect/r/csv.result
  mysql-test/suite/connect/r/dbf.result
  mysql-test/suite/connect/r/fix.result
  mysql-test/suite/connect/r/vec.result
  mysql-test/suite/connect/r/xml.result
  mysql-test/suite/connect/t/grant.inc
  storage/connect/ha_connect.cc
parent b0e07ff5
...@@ -51,6 +51,8 @@ TRUNCATE TABLE t1; ...@@ -51,6 +51,8 @@ TRUNCATE TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 READONLY=1; ALTER TABLE t1 READONLY=1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 FILE_NAME='t2.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1; DROP TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
...@@ -71,8 +73,21 @@ UPDATE v1 SET a=123; ...@@ -71,8 +73,21 @@ UPDATE v1 SET a=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1; DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=BIN;
Warnings:
Warning 1105 No file name. Table will use t1.bin
INSERT INTO t1 VALUES (10);
SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1;
DROP USER user@localhost; DROP USER user@localhost;
# #
# End of grant.inc # End of grant.inc
......
...@@ -51,6 +51,8 @@ TRUNCATE TABLE t1; ...@@ -51,6 +51,8 @@ TRUNCATE TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 READONLY=1; ALTER TABLE t1 READONLY=1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 FILE_NAME='t2.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1; DROP TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
...@@ -71,8 +73,21 @@ UPDATE v1 SET a=123; ...@@ -71,8 +73,21 @@ UPDATE v1 SET a=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1; DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV;
Warnings:
Warning 1105 No file name. Table will use t1.csv
INSERT INTO t1 VALUES (10);
SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1;
DROP USER user@localhost; DROP USER user@localhost;
# #
# End of grant.inc # End of grant.inc
......
...@@ -51,6 +51,8 @@ TRUNCATE TABLE t1; ...@@ -51,6 +51,8 @@ TRUNCATE TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 READONLY=1; ALTER TABLE t1 READONLY=1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 FILE_NAME='t2.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1; DROP TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
...@@ -71,8 +73,21 @@ UPDATE v1 SET a=123; ...@@ -71,8 +73,21 @@ UPDATE v1 SET a=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1; DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF;
Warnings:
Warning 1105 No file name. Table will use t1.dbf
INSERT INTO t1 VALUES (10);
SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1;
DROP USER user@localhost; DROP USER user@localhost;
# #
# End of grant.inc # End of grant.inc
......
...@@ -51,6 +51,8 @@ TRUNCATE TABLE t1; ...@@ -51,6 +51,8 @@ TRUNCATE TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 READONLY=1; ALTER TABLE t1 READONLY=1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 FILE_NAME='t2.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1; DROP TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
...@@ -71,8 +73,21 @@ UPDATE v1 SET a=123; ...@@ -71,8 +73,21 @@ UPDATE v1 SET a=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1; DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX;
Warnings:
Warning 1105 No file name. Table will use t1.fix
INSERT INTO t1 VALUES (10);
SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1;
DROP USER user@localhost; DROP USER user@localhost;
# #
# End of grant.inc # End of grant.inc
......
...@@ -51,6 +51,8 @@ TRUNCATE TABLE t1; ...@@ -51,6 +51,8 @@ TRUNCATE TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 READONLY=1; ALTER TABLE t1 READONLY=1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 FILE_NAME='t2.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1; DROP TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
...@@ -71,8 +73,21 @@ UPDATE v1 SET a=123; ...@@ -71,8 +73,21 @@ UPDATE v1 SET a=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1; DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=VEC MAX_ROWS=100;
Warnings:
Warning 1105 No file name. Table will use t1.vec
INSERT INTO t1 VALUES (10);
SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1;
DROP USER user@localhost; DROP USER user@localhost;
# #
# End of grant.inc # End of grant.inc
......
...@@ -53,6 +53,8 @@ TRUNCATE TABLE t1; ...@@ -53,6 +53,8 @@ TRUNCATE TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 READONLY=1; ALTER TABLE t1 READONLY=1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 FILE_NAME='t2.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1; DROP TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
...@@ -73,8 +75,21 @@ UPDATE v1 SET a=123; ...@@ -73,8 +75,21 @@ UPDATE v1 SET a=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1; DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2,rownode=row';
Warnings:
Warning 1105 No file name. Table will use t1.xml
INSERT INTO t1 VALUES (10);
SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1;
DROP USER user@localhost; DROP USER user@localhost;
# #
# End of grant.inc # End of grant.inc
......
...@@ -45,6 +45,8 @@ TRUNCATE TABLE t1; ...@@ -45,6 +45,8 @@ TRUNCATE TABLE t1;
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
ALTER TABLE t1 READONLY=1; ALTER TABLE t1 READONLY=1;
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
ALTER TABLE t1 FILE_NAME='t2.EXT';
--error ER_ACCESS_DENIED_ERROR
DROP TABLE t1; DROP TABLE t1;
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
...@@ -62,11 +64,20 @@ INSERT INTO v1 VALUES (2); ...@@ -62,11 +64,20 @@ INSERT INTO v1 VALUES (2);
UPDATE v1 SET a=123; UPDATE v1 SET a=123;
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
DELETE FROM v1; DELETE FROM v1;
--disconnect user
--connection default --connection default
SELECT user();
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.EXT --remove_file $MYSQLD_DATADIR/test/t1.EXT
--eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT $TABLE_OPTIONS
INSERT INTO t1 VALUES (10);
--connection user
SELECT user();
--error ER_ACCESS_DENIED_ERROR
ALTER TABLE t1 FILE_NAME='t1.EXT';
--connection default
DROP TABLE t1;
--disconnect user
DROP USER user@localhost; DROP USER user@localhost;
--echo # --echo #
......
...@@ -4250,17 +4250,15 @@ bool ha_connect::check_if_incompatible_data(HA_CREATE_INFO *info, ...@@ -4250,17 +4250,15 @@ bool ha_connect::check_if_incompatible_data(HA_CREATE_INFO *info,
DBUG_ENTER("ha_connect::check_if_incompatible_data"); DBUG_ENTER("ha_connect::check_if_incompatible_data");
// TO DO: implement and check it. // TO DO: implement and check it.
THD *thd= current_thd; THD *thd= current_thd;
#if 0 push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"The current version of CONNECT did not check what you changed in ALTER. Use at your own risk");
if (table) { if (table) {
PTOS options= info->option_struct; PTOS options= info->option_struct;
if (options->filename) if (options->filename)
return COMPATIBLE_DATA_NO; DBUG_RETURN(COMPATIBLE_DATA_NO);
} // endif table } // endif table
#endif // 0
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"The current version of CONNECT did not check what you changed in ALTER. Use at your own risk");
DBUG_RETURN(COMPATIBLE_DATA_YES); DBUG_RETURN(COMPATIBLE_DATA_YES);
} // end of check_if_incompatible_data } // end of check_if_incompatible_data
......
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