86 lines
3.2 KiB
Plaintext
86 lines
3.2 KiB
Plaintext
call mtr.add_suppression("Plugin mysqlx reported: .*Unsuccessful login attempt: Invalid user or password");
|
|
CREATE DATABASE xtest;
|
|
USE xtest;
|
|
CREATE USER user1@'%' IDENTIFIED WITH 'mysql_native_password' BY 'pass_all_hosts';
|
|
CREATE USER user1@'127.0.0.1' IDENTIFIED WITH 'mysql_native_password' BY 'pass_127.0.0.1';
|
|
CREATE USER user1@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'pass_localhost';
|
|
CREATE TABLE `table_all_hosts`(id integer);
|
|
CREATE TABLE `table_127.0.0.1`(id integer);
|
|
CREATE TABLE `table_localhost`(id integer);
|
|
INSERT INTO `table_all_hosts`(id) VALUES(2),(4);
|
|
INSERT INTO `table_127.0.0.1`(id) VALUES(1),(3);
|
|
INSERT INTO `table_localhost`(id) VALUES(5),(6);
|
|
GRANT SELECT ON xtest.`table_all_hosts` TO 'user1'@'%';
|
|
GRANT SELECT ON xtest.`table_127.0.0.1` TO 'user1'@'127.0.0.1';
|
|
GRANT SELECT ON xtest.`table_localhost` TO 'user1'@'localhost';
|
|
##
|
|
## X Plugin should only authenticate 'user1'@'127.0.0.1' account on TCP
|
|
##
|
|
RUN select current_user();
|
|
current_user()
|
|
user1@127.0.0.1
|
|
0 rows affected
|
|
RUN select * from `table_all_hosts`;
|
|
Got expected error (code 0)
|
|
RUN select * from `table_127.0.0.1`;
|
|
Got expected error (code 0)
|
|
RUN select * from `table_localhost`;
|
|
Got expected error (code 0)
|
|
Mysqlx.Ok {
|
|
msg: "bye!"
|
|
}
|
|
Login with 'user1:pass_localhost@localhost/xtest' should fail
|
|
error (as expected): Access denied for user 'user1'@'localhost' (using password: YES) (code 1045)
|
|
ok
|
|
Login with 'user1:pass_all_hosts@localhost/xtest' should fail
|
|
error (as expected): Access denied for user 'user1'@'localhost' (using password: YES) (code 1045)
|
|
ok
|
|
DROP USER user1@'127.0.0.1';
|
|
##
|
|
## X Plugin should only authenticate 'user1'@'127.0.0.%' account on TCP
|
|
##
|
|
Login with 'user1:pass_127.0.0.1@localhost/xtest' should fail
|
|
error (as expected): Access denied for user 'user1'@'localhost' (using password: YES) (code 1045)
|
|
ok
|
|
RUN select current_user();
|
|
current_user()
|
|
user1@localhost
|
|
0 rows affected
|
|
RUN select * from `table_all_hosts`;
|
|
Got expected error (code 0)
|
|
RUN select * from `table_127.0.0.1`;
|
|
Got expected error: SELECT command denied to user 'user1'@'localhost' for table 'table_127.0.0.1' (code 1142)
|
|
RUN select * from `table_localhost`;
|
|
Got expected error (code 0)
|
|
Mysqlx.Ok {
|
|
msg: "bye!"
|
|
}
|
|
Login with 'user1:pass_all_hosts@localhost/xtest' should fail
|
|
error (as expected): Access denied for user 'user1'@'localhost' (using password: YES) (code 1045)
|
|
ok
|
|
DROP USER user1@'localhost';
|
|
##
|
|
## X Plugin should only authenticate 'user1'@'%' account on TCP
|
|
##
|
|
Login with 'user1:pass_127.0.0.1@localhost/xtest' should fail
|
|
error (as expected): Access denied for user 'user1'@'localhost' (using password: YES) (code 1045)
|
|
ok
|
|
Login with 'user1:pass_localhost@localhost/xtest' should fail
|
|
error (as expected): Access denied for user 'user1'@'localhost' (using password: YES) (code 1045)
|
|
ok
|
|
RUN select current_user();
|
|
current_user()
|
|
user1@%
|
|
0 rows affected
|
|
RUN select * from `table_all_hosts`;
|
|
Got expected error (code 0)
|
|
RUN select * from `table_127.0.0.1`;
|
|
Got expected error: SELECT command denied to user 'user1'@'localhost' for table 'table_127.0.0.1' (code 1142)
|
|
RUN select * from `table_localhost`;
|
|
Got expected error: SELECT command denied to user 'user1'@'localhost' for table 'table_localhost' (code 1142)
|
|
Mysqlx.Ok {
|
|
msg: "bye!"
|
|
}
|
|
DROP DATABASE xtest;
|
|
DROP USER user1@'%';
|