Commit 92eafe1a authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-5521 SET ROLE as prepared statement crashes the server

set_role::light_check() was incorrect
parent 03b428d2
PREPARE stmt FROM 'SET ROLE NONE';
#
# MDEV-5521 SET ROLE as prepared statement crashes the server
#
PREPARE stmt FROM 'SET ROLE NONE';
......@@ -855,9 +855,7 @@ int set_var_password::update(THD *thd)
int set_var_role::check(THD *thd)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
ulonglong access;
int status= acl_check_setrole(thd, base.str, &access);
save_result.ulonglong_value= access;
int status= acl_check_setrole(thd, role.str, &access);
return status;
#else
return 0;
......@@ -867,7 +865,7 @@ int set_var_role::check(THD *thd)
int set_var_role::update(THD *thd)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
return acl_setrole(thd, base.str, save_result.ulonglong_value);
return acl_setrole(thd, role.str, access);
#else
return 0;
#endif
......
......@@ -278,11 +278,12 @@ public:
/* For SET ROLE */
class set_var_role: public set_var
class set_var_role: public set_var_base
{
LEX_STRING role;
ulonglong access;
public:
set_var_role(LEX_STRING role_arg) :
set_var(OPT_SESSION, NULL, &role_arg, NULL){};
set_var_role(LEX_STRING role_arg) : role(role_arg) {}
int check(THD *thd);
int update(THD *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