summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-06-03 09:45:39 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-06-03 09:45:39 +0300
commit701efbb25b738f0c971798c5234d4d66b9235e47 (patch)
tree0835d2d3e58ffa8566cf6b1e8211d6484bccc57c /sql/set_var.cc
parentd5e8b4d7f97c7a15be5d58b6f088c4c64787a385 (diff)
parent80591481549213f5701642e682cc2974b60c53dd (diff)
downloadmariadb-git-701efbb25b738f0c971798c5234d4d66b9235e47.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 0ace4658be7..38c8d1f1775 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -994,8 +994,17 @@ int set_var_default_role::check(THD *thd)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
real_user= get_current_user(thd, user);
- int status= acl_check_set_default_role(thd, real_user->host.str, real_user->user.str);
- return status;
+ real_role= role.str;
+ if (role.str == current_role.str)
+ {
+ if (!thd->security_ctx->priv_role[0])
+ real_role= "NONE";
+ else
+ real_role= thd->security_ctx->priv_role;
+ }
+
+ return acl_check_set_default_role(thd, real_user->host.str,
+ real_user->user.str, real_role);
#else
return 0;
#endif
@@ -1006,7 +1015,8 @@ int set_var_default_role::update(THD *thd)
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
thd->m_reprepare_observer= 0;
- int res= acl_set_default_role(thd, real_user->host.str, real_user->user.str, role.str);
+ int res= acl_set_default_role(thd, real_user->host.str, real_user->user.str,
+ real_role);
thd->m_reprepare_observer= save_reprepare_observer;
return res;
#else