summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-06-01 09:33:03 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-06-01 09:33:03 +0300
commitd72eebaa3dbec025ec43d101a1c8055cfd1ddaef (patch)
tree5b2dea3a82cbef8c6b0689ad02419d5bf4e2bf82 /sql/set_var.cc
parent4832b751ad47626f236e25067508230df72749e6 (diff)
parent49854811fa499c70ddbf5d7d4daf22c97796b98e (diff)
downloadmariadb-git-d72eebaa3dbec025ec43d101a1c8055cfd1ddaef.tar.gz
Merge 10.1 into 10.2
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 036cc5f1d43..569362fb7bd 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -971,8 +971,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
@@ -983,7 +992,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