mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
MDEV-9580 SHOW GRANTS FOR <current_user> fails
use get_current_user() to distinguish user name without a hostname and a role name. move privilege checks inside mysql_show_grants() to remove duplicate get_current_user() calls
This commit is contained in:
@@ -4374,21 +4374,10 @@ end_with_restore_list:
|
||||
case SQLCOM_SHOW_GRANTS:
|
||||
{
|
||||
LEX_USER *grant_user= lex->grant_user;
|
||||
Security_context *sctx= thd->security_ctx;
|
||||
if (!grant_user)
|
||||
goto error;
|
||||
|
||||
if (grant_user->user.str && !strcmp(sctx->priv_user, grant_user->user.str) &&
|
||||
grant_user->host.str && !strcmp(sctx->priv_host, grant_user->host.str))
|
||||
grant_user->user= current_user;
|
||||
|
||||
if (grant_user->user.str == current_user.str ||
|
||||
grant_user->user.str == current_role.str ||
|
||||
grant_user->user.str == current_user_and_current_role.str ||
|
||||
!check_access(thd, SELECT_ACL, "mysql", NULL, NULL, 1, 0))
|
||||
{
|
||||
res = mysql_show_grants(thd, grant_user);
|
||||
}
|
||||
res = mysql_show_grants(thd, grant_user);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user