mariadb/mysql-test/main/grant_kill.test
Dmitry Shulga 73e1e6d28f MDEV-35617: DROP USER should leave no active session for that user
Follow-up patch with adjustments of test files and updates of result
files for tests. Part 3
2025-06-09 18:25:50 +07:00

70 lines
1.8 KiB
Text

-- source include/not_embedded.inc
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-21743 Split up SUPER privilege to smaller privileges
--echo #
--disable_service_connection
--let $count_sessions=1
--echo #
--echo # Test that KILL is not allowed without CONNECTION ADMIN
--echo #
CREATE USER foo@localhost;
GRANT SELECT ON *.* TO foo@localhost;
CREATE USER bar@localhost;
GRANT ALL PRIVILEGES ON *.* TO bar@localhost;
REVOKE CONNECTION ADMIN ON *.* FROM bar@localhost;
--connect (foo,localhost,foo,,)
let $id=`(SELECT id FROM INFORMATION_SCHEMA.PROCESSLIST WHERE user='foo')`;
--connect (bar,localhost,bar,,)
SELECT user FROM information_schema.processlist ORDER BY user;
--replace_result $id ID
--error ER_KILL_DENIED_ERROR
--eval KILL $id
--disconnect foo
--disconnect bar
--connection default
--source include/wait_until_count_sessions.inc
--disable_warnings
DROP USER foo@localhost;
DROP USER bar@localhost;
--enable_warnings
--echo #
--echo # Test that KILL is allowed with CONNECTION ADMIN
--echo #
CREATE USER foo@localhost;
GRANT SELECT ON *.* TO foo@localhost;
CREATE USER bar@localhost;
GRANT PROCESS, CONNECTION ADMIN ON *.* TO bar@localhost;
--connect (foo,localhost,foo,,)
let $id=`(SELECT id FROM INFORMATION_SCHEMA.PROCESSLIST WHERE user='foo')`;
--connect (bar,localhost,bar,,)
SELECT user FROM information_schema.processlist ORDER BY user;
--replace_result $id ID
--eval KILL $id
--connection default
let $wait_condition=
select count(*) = 0 from information_schema.processlist
where user = "foo";
--source include/wait_condition.inc
--disconnect foo
--disconnect bar
--source include/wait_until_count_sessions.inc
--disable_warnings
DROP USER foo@localhost;
DROP USER bar@localhost;
--enable_warnings
--enable_service_connection
--echo #
--echo # End of 10.5 tests
--echo #