summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index ccf5c08136f..cee216257be 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1052,8 +1052,10 @@ int sp_head::execute(THD *thd)
original thd->db will then have been freed */
if (dbchanged)
{
+ /* No access check when changing back to where we came from.
+ (It would generate an error from mysql_change_db() when olddb=="") */
if (! thd->killed)
- ret= mysql_change_db(thd, olddb, 0);
+ ret= mysql_change_db(thd, olddb, 1);
}
m_flags&= ~IS_INVOKED;
DBUG_RETURN(ret);
@@ -2651,9 +2653,24 @@ sp_change_security_context(THD *thd, sp_head *sp, Security_context **backup)
sp->m_definer_host.str,
sp->m_db.str))
{
+#ifdef NOT_YET_REPLICATION_SAFE
+ /*
+ Until we don't properly replicate information about stored routine
+ definer with stored routine creation statement all stored routines
+ on slave are created under ''@'' definer. Therefore we won't be able
+ to run any routine which was replicated from master on slave server
+ if we emit error here. This will cause big problems for users
+ who use slave for fail-over. So until we fully implement WL#2897
+ "Complete definer support in the stored routines" we run suid
+ stored routines for which we were unable to find definer under
+ invoker security context.
+ */
my_error(ER_NO_SUCH_USER, MYF(0), sp->m_definer_user.str,
sp->m_definer_host.str);
return TRUE;
+#else
+ return FALSE;
+#endif
}
*backup= thd->security_ctx;
thd->security_ctx= &sp->m_security_ctx;