diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-06-01 09:33:03 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-06-01 09:33:03 +0300 |
commit | d72eebaa3dbec025ec43d101a1c8055cfd1ddaef (patch) | |
tree | 5b2dea3a82cbef8c6b0689ad02419d5bf4e2bf82 /sql/set_var.cc | |
parent | 4832b751ad47626f236e25067508230df72749e6 (diff) | |
parent | 49854811fa499c70ddbf5d7d4daf22c97796b98e (diff) | |
download | mariadb-git-d72eebaa3dbec025ec43d101a1c8055cfd1ddaef.tar.gz |
Merge 10.1 into 10.2
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r-- | sql/set_var.cc | 16 |
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 |