146 lines
2.7 KiB
Plaintext
146 lines
2.7 KiB
Plaintext
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;
|
|
send Mysqlx.Sql.StmtExecute {
|
|
stmt: "list_clients"
|
|
namespace: "xplugin"
|
|
}
|
|
|
|
client_id user host sql_session
|
|
1 x_root localhost $SESSION
|
|
command ok
|
|
Namespace 'xplugin' is deprecated, please use 'mysqlx' instead
|
|
connecting...
|
|
active session is now 'aux'
|
|
send Mysqlx.Sql.StmtExecute {
|
|
stmt: "list_clients"
|
|
namespace: "xplugin"
|
|
}
|
|
|
|
client_id user host sql_session
|
|
1 x_root localhost $SESSION
|
|
2 x_root localhost $SESSION
|
|
command ok
|
|
Namespace 'xplugin' is deprecated, please use 'mysqlx' instead
|
|
switched to session default
|
|
send Mysqlx.Sql.StmtExecute {
|
|
stmt: "list_clients"
|
|
namespace: "xplugin"
|
|
}
|
|
|
|
client_id user host sql_session
|
|
1 x_root localhost $SESSION
|
|
2 x_root localhost $SESSION
|
|
command ok
|
|
connecting...
|
|
active session is now 'unpriv'
|
|
Should list unprivs session only
|
|
send Mysqlx.Sql.StmtExecute {
|
|
stmt: "list_clients"
|
|
namespace: "xplugin"
|
|
}
|
|
|
|
client_id user host sql_session
|
|
3 unpriv localhost $SESSION
|
|
command ok
|
|
Namespace 'xplugin' is deprecated, please use 'mysqlx' instead
|
|
Try to kill a x_root session from regular session
|
|
send Mysqlx.Sql.StmtExecute {
|
|
stmt: "kill_client"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_UINT
|
|
v_unsigned_int: 2
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
|
|
Got expected error:
|
|
Mysqlx.Error {
|
|
severity: ERROR
|
|
code: 1095
|
|
msg: "You are not owner of thread"
|
|
sql_state: "HY000"
|
|
}
|
|
|
|
promote regular session to power session
|
|
RUN set role sys_user_role
|
|
|
|
0 rows affected
|
|
Try to kill a x_root session from unpriv
|
|
send Mysqlx.Sql.StmtExecute {
|
|
stmt: "kill_client"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_UINT
|
|
v_unsigned_int: 2
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
|
|
|
|
command ok
|
|
switched to session default
|
|
RUN select sleep(0.5)
|
|
sleep(0.5)
|
|
0
|
|
0 rows affected
|
|
Should two sessions
|
|
send Mysqlx.Sql.StmtExecute {
|
|
stmt: "list_clients"
|
|
namespace: "xplugin"
|
|
}
|
|
|
|
client_id user host sql_session
|
|
1 x_root localhost $SESSION
|
|
3 unpriv localhost $SESSION
|
|
command ok
|
|
Now kill one power_session from another power_session
|
|
send Mysqlx.Sql.StmtExecute {
|
|
stmt: "kill_client"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_UINT
|
|
v_unsigned_int: 3
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
|
|
|
|
command ok
|
|
RUN select sleep(0.5)
|
|
sleep(0.5)
|
|
0
|
|
0 rows affected
|
|
Should list only x_root session
|
|
send Mysqlx.Sql.StmtExecute {
|
|
stmt: "list_clients"
|
|
namespace: "xplugin"
|
|
}
|
|
|
|
client_id user host sql_session
|
|
1 x_root localhost $SESSION
|
|
command ok
|
|
RUN drop schema if exists xtest
|
|
|
|
0 rows affected
|
|
RUN drop user unpriv@localhost
|
|
|
|
0 rows affected
|
|
RUN drop role sys_user_role
|
|
|
|
0 rows affected
|
|
Mysqlx.Ok {
|
|
msg: "bye!"
|
|
}
|
|
ok
|