Commit fc0d9a47 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-22966 Server crashes or hangs with SET ROLE when started with skip-grant-tables

parent 69f1adaa
...@@ -99,3 +99,11 @@ Acl_users 0 ...@@ -99,3 +99,11 @@ Acl_users 0
# #
# End of 10.1 tests # End of 10.1 tests
# #
#
# MDEV-22966 Server crashes or hangs with SET ROLE when started with skip-grant-tables
#
set role x;
ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
#
# End of 10.2 tests
#
...@@ -128,3 +128,14 @@ show global status like 'Acl%'; ...@@ -128,3 +128,14 @@ show global status like 'Acl%';
--echo # --echo #
--echo # End of 10.1 tests --echo # End of 10.1 tests
--echo # --echo #
--echo #
--echo # MDEV-22966 Server crashes or hangs with SET ROLE when started with skip-grant-tables
--echo #
--error ER_OPTION_PREVENTS_STATEMENT
set role x;
--echo #
--echo # End of 10.2 tests
--echo #
...@@ -2770,6 +2770,12 @@ static int check_user_can_set_role(THD *thd, const char *user, const char *host, ...@@ -2770,6 +2770,12 @@ static int check_user_can_set_role(THD *thd, const char *user, const char *host,
int acl_check_setrole(THD *thd, char *rolename, ulonglong *access) int acl_check_setrole(THD *thd, char *rolename, ulonglong *access)
{ {
if (!initialized)
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
return 1;
}
return check_user_can_set_role(thd, thd->security_ctx->priv_user, return check_user_can_set_role(thd, thd->security_ctx->priv_user,
thd->security_ctx->host, thd->security_ctx->ip, rolename, access); thd->security_ctx->host, thd->security_ctx->ip, rolename, access);
} }
......
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