summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorunknown <malff/marcsql@weblab.(none)>2007-04-20 15:31:41 -0600
committerunknown <malff/marcsql@weblab.(none)>2007-04-20 15:31:41 -0600
commite3ccf3c6638f17163d93f5f071a71e0e6feb203a (patch)
tree7cc9d8ee328658227b1d4c61228a800baadcd68d /sql/sp_head.cc
parent51e016f1845b962a705af589aa7af599462c1743 (diff)
parente2c47cc462816ca465e76b9ed82df4b4adc31120 (diff)
downloadmariadb-git-e3ccf3c6638f17163d93f5f071a71e0e6feb203a.tar.gz
Merge weblab.(none):/home/marcsql/TREE/mysql-5.1-base
into weblab.(none):/home/marcsql/TREE/mysql-5.1-rt-merge client/mysqldump.c: Auto merged mysql-test/t/sp.test: Auto merged sql/event_data_objects.cc: Auto merged sql/item_func.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc50
1 files changed, 8 insertions, 42 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index a2ce5111a25..04a7b2574a4 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1245,7 +1245,11 @@ set_routine_security_ctx(THD *thd, sp_head *sp, bool is_proc,
Security_context **save_ctx)
{
*save_ctx= 0;
- if (sp_change_security_context(thd, sp, save_ctx))
+ if (sp->m_chistics->suid != SP_IS_NOT_SUID &&
+ sp->m_security_ctx.change_security_context(thd, &sp->m_definer_user,
+ &sp->m_definer_host,
+ &sp->m_db,
+ save_ctx))
return TRUE;
/*
@@ -1262,7 +1266,7 @@ set_routine_security_ctx(THD *thd, sp_head *sp, bool is_proc,
check_routine_access(thd, EXECUTE_ACL,
sp->m_db.str, sp->m_name.str, is_proc, FALSE))
{
- sp_restore_security_context(thd, *save_ctx);
+ sp->m_security_ctx.restore_security_context(thd, *save_ctx);
*save_ctx= 0;
return TRUE;
}
@@ -1573,7 +1577,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
- sp_restore_security_context(thd, save_security_ctx);
+ m_security_ctx.restore_security_context(thd, save_security_ctx);
#endif
err_with_cleanup:
@@ -1791,7 +1795,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (save_security_ctx)
- sp_restore_security_context(thd, save_security_ctx);
+ m_security_ctx.restore_security_context(thd, save_security_ctx);
#endif
if (!save_spcont)
@@ -3431,44 +3435,6 @@ sp_instr_set_case_expr::opt_move(uint dst, List<sp_instr> *bp)
/* ------------------------------------------------------------------ */
-/*
- Security context swapping
-*/
-
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
-bool
-sp_change_security_context(THD *thd, sp_head *sp, Security_context **backup)
-{
- *backup= 0;
- if (sp->m_chistics->suid != SP_IS_NOT_SUID &&
- (strcmp(sp->m_definer_user.str,
- thd->security_ctx->priv_user) ||
- my_strcasecmp(system_charset_info, sp->m_definer_host.str,
- thd->security_ctx->priv_host)))
- {
- if (acl_getroot_no_password(&sp->m_security_ctx, sp->m_definer_user.str,
- sp->m_definer_host.str,
- sp->m_definer_host.str,
- sp->m_db.str))
- {
- my_error(ER_NO_SUCH_USER, MYF(0), sp->m_definer_user.str,
- sp->m_definer_host.str);
- return TRUE;
- }
- *backup= thd->security_ctx;
- thd->security_ctx= &sp->m_security_ctx;
- }
- return FALSE;
-}
-
-void
-sp_restore_security_context(THD *thd, Security_context *backup)
-{
- if (backup)
- thd->security_ctx= backup;
-}
-
-#endif /* NO_EMBEDDED_ACCESS_CHECKS */
/*
Structure that represent all instances of one table