summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorunknown <gluh@gluh.mysql.r18.ru>2005-03-05 14:35:32 +0300
committerunknown <gluh@gluh.mysql.r18.ru>2005-03-05 14:35:32 +0300
commit0d7e68c92a4ded30d02a66b434cbe624c3df5e1e (patch)
treed882344cb6e35451bd9dffbfd69b088912a9fce8 /sql/sql_acl.cc
parent0ae5efb4dc1df3af598030cf7b96b95841306c70 (diff)
downloadmariadb-git-0d7e68c92a4ded30d02a66b434cbe624c3df5e1e.tar.gz
WL2131: Access control for SHOW ... PROCEDURE|FUNCTION ...
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 041154c96cc..3db219b5fdc 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -3583,6 +3583,37 @@ err:
}
+/*
+ Check if routine has any of the
+ procedure level grants
+
+ SYNPOSIS
+ bool check_routine_level_acl()
+ thd Thread handler
+ db Database name
+ name Routine name
+
+ RETURN
+ 1 error
+ 0 Ok
+*/
+
+bool check_routine_level_acl(THD *thd, char *db, char *name)
+{
+ bool no_routine_acl= 1;
+ if (grant_option)
+ {
+ GRANT_NAME *grant_proc;
+ rw_rdlock(&LOCK_grant);
+ if ((grant_proc= proc_hash_search(thd->priv_host, thd->ip, db,
+ thd->priv_user, name, 0)))
+ no_routine_acl= !(grant_proc->privs & SHOW_PROC_ACLS);
+ rw_unlock(&LOCK_grant);
+ }
+ return no_routine_acl;
+}
+
+
/*****************************************************************************
Functions to retrieve the grant for a table/column (for SHOW functions)
*****************************************************************************/