############################################################################### # WL#12364: Kill administration for system users # # # # This test file covers the scenarios around prohibiting the killing # # connections of a user who is granted the SYSTEM_USER dynamic privilege # # from the connections of a user who is not granted the SYSTEM_USER # # dynamic privilege. # # # ############################################################################### --source include/xplugin_preamble.inc --source include/xplugin_create_user.inc create user unpriv@localhost; set password for unpriv@localhost = 'x'; grant connection_admin on *.* to unpriv@localhost; create role sys_user_role; grant system_user on *.* to sys_user_role; grant sys_user_role to unpriv@localhost; ## Test starts here --write_file $MYSQL_TMP_DIR/system_user_kill.xpl ## Test data -->stmtadmin list_clients ## expect Mysqlx.Sql.StmtExecuteOk -->recvresult ## create and activate new session -->newsession aux x_root -->stmtadmin list_clients ## expect Mysqlx.Sql.StmtExecuteOk -->recvresult ## switch back to default session -->setsession -->stmtadmin list_clients ## expect Mysqlx.Sql.StmtExecuteOk -->recvresult ### Create a separate session with diff account -->newsession unpriv unpriv x -->echo Should list unprivs session only -->stmtadmin list_clients -->recvresult -->echo Try to kill a x_root session from regular session -->stmtadmin kill_client {"id": 2 } -->recverror 1095 -->echo promote regular session to power session -->sql set role sys_user_role; -->endsql -->echo Try to kill a x_root session from unpriv -->stmtadmin kill_client {"id": 2} ## expect Mysqlx.Sql.StmtExecuteOk -->recvresult -->setsession -->quiet -->wait_for 2 SELECT count(*) FROM information_schema.processlist WHERE info LIKE "PLUGIN%" -->noquiet -->echo Should two sessions -->stmtadmin list_clients -->recvresult -->echo Now kill one power_session from another power_session -->stmtadmin kill_client {"id": 3} -->recvresult -->quiet -->wait_for 1 SELECT count(*) FROM information_schema.processlist WHERE info LIKE "PLUGIN%" -->noquiet -->echo Should list only x_root session -->stmtadmin list_clients -->recvresult ## Cleanup -->sql drop schema if exists xtest; drop user unpriv@localhost; drop role sys_user_role; -->endsql EOF --replace_regex /([a-z]*.+localhost[ ]+)[0-9]+/\1$SESSION/ /You are not owner of thread [0-9]+/You are not owner of thread/ --exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/system_user_kill.xpl 2>&1 ## Cleanup --source ../include/xplugin_cleanup.inc