Commit eedea4dd authored by Alexander Barkov's avatar Alexander Barkov

Adding GRANT tests for ODBC

modified:
  mysql-test/suite/connect/r/odbc_sqlite3.result
  mysql-test/suite/connect/t/odbc_sqlite3.test
parent 2d5a8036
......@@ -4,6 +4,20 @@ t1 CREATE TABLE `t1` (
`Attributes` varchar(256) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=ODBC `CATFUNC`=Drivers
SET NAMES utf8;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
SELECT user();
user()
user@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=ODBC;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Drivers;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Sources;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=MYSQL_TEST_DIR/suite/connect/std_data/test.sqlite3;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8;;
SHOW CREATE TABLE t1;
Table Create Table
......@@ -17,4 +31,42 @@ test2
тест1
тест2
ÆÇÈÉË
SELECT user();
user()
user@localhost
SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO t1 VALUES ('xxx');
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM t1 WHERE a='xxx';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE t1 SET a='yyy' WHERE a='xxx';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
TRUNCATE TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 READONLY=1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
# Testing a VIEW created with FILE privileges but accessed with no FILE
SELECT user();
user()
root@localhost
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT user();
user()
user@localhost
SELECT * FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO v1 VALUES (2);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE v1 SET a=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
DROP VIEW v1;
DROP TABLE t1;
DROP USER user@localhost;
......@@ -38,7 +38,21 @@ SET NAMES utf8;
let $MYSQLD_DATADIR= `select @@datadir`;
let $Database=$MYSQL_TEST_DIR/suite/connect/std_data/test.sqlite3;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
--connect(user,localhost,user,,)
--connection user
SELECT user();
--error ER_ACCESS_DENIED_ERROR
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=ODBC;
--error ER_ACCESS_DENIED_ERROR
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Drivers;
--error ER_ACCESS_DENIED_ERROR
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Sources;
--connection default
SELECT user();
#
# For some reasons Windows does not allow to remove the data base
......@@ -46,10 +60,48 @@ let $Database=$MYSQL_TEST_DIR/suite/connect/std_data/test.sqlite3;
# the data file, we'll use directly the file in std_data.
# As we do not do any modifications in the database, this should be OK.
#
let $Database=$MYSQL_TEST_DIR/suite/connect/std_data/test.sqlite3;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=$Database;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
SHOW CREATE TABLE t1;
SELECT * FROM t1;
--connection user
SELECT user();
--error ER_ACCESS_DENIED_ERROR
SELECT * FROM t1;
--error ER_ACCESS_DENIED_ERROR
INSERT INTO t1 VALUES ('xxx');
--error ER_ACCESS_DENIED_ERROR
DELETE FROM t1 WHERE a='xxx';
--error ER_ACCESS_DENIED_ERROR
UPDATE t1 SET a='yyy' WHERE a='xxx';
--error ER_ACCESS_DENIED_ERROR
TRUNCATE TABLE t1;
--error ER_ACCESS_DENIED_ERROR
ALTER TABLE t1 READONLY=1;
--error ER_ACCESS_DENIED_ERROR
CREATE VIEW v1 AS SELECT * FROM t1;
--echo # Testing a VIEW created with FILE privileges but accessed with no FILE
--connection default
SELECT user();
CREATE VIEW v1 AS SELECT * FROM t1;
--connection user
SELECT user();
--error ER_ACCESS_DENIED_ERROR
SELECT * FROM v1;
--error ER_ACCESS_DENIED_ERROR
INSERT INTO v1 VALUES (2);
--error ER_ACCESS_DENIED_ERROR
UPDATE v1 SET a=123;
--error ER_ACCESS_DENIED_ERROR
DELETE FROM v1;
--disconnect user
--connection default
SELECT user();
DROP VIEW v1;
DROP TABLE t1;
DROP USER user@localhost;
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