summaryrefslogtreecommitdiff
path: root/sql/sp.cc
diff options
context:
space:
mode:
authorDmitry Lenev <Dmitry.Lenev@oracle.com>2010-10-07 20:01:17 +0400
committerDmitry Lenev <Dmitry.Lenev@oracle.com>2010-10-07 20:01:17 +0400
commit51ff281efe80797e307e9d25efaa1c7bebc17597 (patch)
tree52fe8883af8edd4beabecb0e989d80f49ea3222d /sql/sp.cc
parent53c5decb7cdbc52f1cd9d37f0bb62e53380c43b4 (diff)
downloadmariadb-git-51ff281efe80797e307e9d25efaa1c7bebc17597.tar.gz
Fix for bug#57061 "User without privilege on routine can
discover its existence". The problem was that user without any privileges on routine was able to find out whether it existed or not. DROP FUNCTION and DROP PROCEDURE statements were checking if routine being dropped existed and reported ER_SP_DOES_NOT_EXIST error/warning before checking if user had enough privileges to drop it. This patch solves this problem by changing code not to check if routine exists before checking if user has enough privileges to drop it. Moreover we no longer perform this check using a separate call instead we rely on sp_drop_routine() returning SP_KEY_NOT_FOUND if routine doesn't exist. This change also simplifies one of upcoming patches refactoring global read lock implementation.
Diffstat (limited to 'sql/sp.cc')
-rw-r--r--sql/sp.cc32
1 files changed, 0 insertions, 32 deletions
diff --git a/sql/sp.cc b/sql/sp.cc
index 8821dc9365d..87eb40c29ac 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1636,38 +1636,6 @@ sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any)
}
-/**
- Check if a routine exists in the mysql.proc table, without actually
- parsing the definition. (Used for dropping).
-
- @param thd thread context
- @param name name of procedure
-
- @retval
- 0 Success
- @retval
- non-0 Error; SP_OPEN_TABLE_FAILED or SP_KEY_NOT_FOUND
-*/
-
-int
-sp_routine_exists_in_table(THD *thd, int type, sp_name *name)
-{
- TABLE *table;
- int ret;
- Open_tables_backup open_tables_state_backup;
-
- if (!(table= open_proc_table_for_read(thd, &open_tables_state_backup)))
- ret= SP_OPEN_TABLE_FAILED;
- else
- {
- if ((ret= db_find_routine_aux(thd, type, name, table)) != SP_OK)
- ret= SP_KEY_NOT_FOUND;
- close_system_tables(thd, &open_tables_state_backup);
- }
- return ret;
-}
-
-
extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen,
my_bool first)
{