summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-10-30 16:42:46 +0400
committerAlexander Barkov <bar@mariadb.org>2017-10-30 16:42:46 +0400
commit003cb2f42477772ae43228c0bc0f8492246b9340 (patch)
tree680314d232d55b5a41dc2b2f5b500677e4aff183 /sql/sp_head.cc
parent84ed288f6807a4602e0af8615bfb17080df15160 (diff)
parent58e0dcb93dc2b2bf49f76c754bd216dbdf875a0d (diff)
downloadmariadb-git-003cb2f42477772ae43228c0bc0f8492246b9340.tar.gz
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 82123c6ad6e..73ce5403f38 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -2544,10 +2544,18 @@ bool check_show_routine_access(THD *thd, sp_head *sp, bool *full_access)
*full_access= ((!check_table_access(thd, SELECT_ACL, &tables, FALSE,
1, TRUE) &&
(tables.grant.privilege & SELECT_ACL) != 0) ||
+ /* Check if user owns the routine. */
(!strcmp(sp->m_definer.user.str,
thd->security_ctx->priv_user) &&
!strcmp(sp->m_definer.host.str,
- thd->security_ctx->priv_host)));
+ thd->security_ctx->priv_host)) ||
+ /* Check if current role or any of the sub-granted roles
+ own the routine. */
+ (sp->m_definer.host.length == 0 &&
+ (!strcmp(sp->m_definer.user.str,
+ thd->security_ctx->priv_role) ||
+ check_role_is_granted(thd->security_ctx->priv_role, NULL,
+ sp->m_definer.user.str))));
if (!*full_access)
return check_some_routine_access(thd, sp->m_db.str, sp->m_name.str,
sp->m_handler);