Commit b7e0c11a authored by unknown's avatar unknown

We now require SUPER privilege for SET PSEUDO_THREAD_ID.


mysql-test/r/rpl_temporary.result:
  result update
mysql-test/t/rpl_temporary.test:
  test that PSEUDO_THREAD_ID now requires SUPER.
sql/set_var.cc:
  Class for pseudo_thread_id (it used to be sys_var_thd_ulong, but we 
  decided to require the SUPER privilege so we needed a check() function,
  which sys_var_thd_ulong does not feature (check() is virtual in sys_var
  and in sys_var_thd_ulong too).
sql/set_var.h:
  Class for pseudo_thread_id
parent 0826127b
......@@ -5,6 +5,8 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
reset master;
SET @@session.pseudo_thread_id=100;
ERROR HY000: Access denied. You need the SUPER privilege for this operation
drop table if exists t1,t2;
create table t1(f int);
create table t2(f int);
......
......@@ -19,6 +19,14 @@ connection master;
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connect (con3,localhost,test,,);
# We are going to use SET PSEUDO_THREAD_ID in this test;
# check that it requires the SUPER privilege.
connection con3;
--error 1227
SET @@session.pseudo_thread_id=100;
let $VERSION=`select version()`;
......
......@@ -168,7 +168,11 @@ sys_var_thd_ulong sys_max_error_count("max_error_count",
&SV::max_error_count);
sys_var_thd_ulong sys_max_heap_table_size("max_heap_table_size",
&SV::max_heap_table_size);
sys_var_thd_ulong sys_pseudo_thread_id("pseudo_thread_id",
/*
sys_pseudo_thread_id has its own class (instead of sys_var_thd_ulong) because
we want a check() function.
*/
sys_var_pseudo_thread_id sys_pseudo_thread_id("pseudo_thread_id",
&SV::pseudo_thread_id);
sys_var_thd_ha_rows sys_max_join_size("max_join_size",
&SV::max_join_size,
......@@ -1454,6 +1458,17 @@ byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type)
return (byte*) &thd->current_insert_id;
}
bool sys_var_pseudo_thread_id::check(THD *thd, set_var *var)
{
if (thd->master_access & SUPER_ACL)
return 0;
else
{
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
return 1;
}
}
#ifdef HAVE_REPLICATION
bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
......
......@@ -212,6 +212,15 @@ public:
byte *value_ptr(THD *thd, enum_var_type type);
};
class sys_var_pseudo_thread_id :public sys_var_thd_ulong
{
public:
sys_var_pseudo_thread_id(const char *name_arg, ulong SV::*offset_arg)
:sys_var_thd_ulong(name_arg, offset_arg)
{}
bool check(THD *thd, set_var *var);
};
class sys_var_thd_ha_rows :public sys_var_thd
{
......
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