Below is the list of changes that have just been committed into a local
5.0 repository of bell. When bell does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1981 05/06/22 15:37:22 bell@stripped +5 -0
fixed environment restoring in case of error during SP function execution (BUG#9503)
#define macro improvement
sql/sql_class.h
1.242 05/06/22 15:37:18 bell@stripped +2 -2
fixed #defines to force them to be alvaise in piar, and variable name made more complex for accident repeating in other code
sql/protocol.cc
1.107 05/06/22 15:37:18 bell@stripped +5 -0
added debug print
sql/item_func.cc
1.224 05/06/22 15:37:18 bell@stripped +7 -3
fixed environment restoring in case of error during SP function execution
mysql-test/t/sp-security.test
1.16 05/06/22 15:37:18 bell@stripped +36 -0
BUG#9503: reseting correct parameters of thread after error in SP function
mysql-test/r/sp-security.result
1.14 05/06/22 15:37:18 bell@stripped +17 -0
BUG#9503: reseting correct parameters of thread after error in SP function
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: bell
# Host: sanja.is.com.ua
# Root: /home/bell/mysql/bk/work-bug3-5.0
--- 1.223/sql/item_func.cc Tue Jun 21 20:30:44 2005
+++ 1.224/sql/item_func.cc Wed Jun 22 15:37:18 2005
@@ -4830,10 +4830,11 @@
thd->net.no_send_ok= TRUE;
#endif
+ res= -1;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_routine_access(thd, EXECUTE_ACL,
m_sp->m_db.str, m_sp->m_name.str, 0, 0))
- DBUG_RETURN(-1);
+ goto exit;
sp_change_security_context(thd, m_sp, &save_ctx);
if (save_ctx.changed &&
check_routine_access(thd, EXECUTE_ACL,
@@ -4841,7 +4842,7 @@
{
sp_restore_security_context(thd, m_sp, &save_ctx);
thd->client_capabilities|= old_client_capabilites & CLIENT_MULTI_RESULTS;
- DBUG_RETURN(-1);
+ goto exit;
}
#endif
/*
@@ -4850,6 +4851,7 @@
it's not (e.g. SELECT myfunc()) it won't be binlogged (documented known
problem).
*/
+
tmp_disable_binlog(thd); /* don't binlog the substatements */
thd->transaction.in_sub_stmt= TRUE;
@@ -4868,11 +4870,13 @@
sp_restore_security_context(thd, m_sp, &save_ctx);
#endif
+ thd->client_capabilities|= old_client_capabilites & CLIENT_MULTI_RESULTS;
+
+exit:
#ifndef EMBEDDED_LIBRARY
thd->net.no_send_ok= nsok;
#endif
- thd->client_capabilities|= old_client_capabilites & CLIENT_MULTI_RESULTS;
DBUG_RETURN(res);
}
--- 1.106/sql/protocol.cc Mon Jun 6 21:21:26 2005
+++ 1.107/sql/protocol.cc Wed Jun 22 15:37:18 2005
@@ -294,7 +294,12 @@
DBUG_ENTER("send_ok");
if (net->no_send_ok || !net->vio) // hack for re-parsing queries
+ {
+ DBUG_PRINT("info", ("no send ok: %s, vio present: %s",
+ (net->no_send_ok ? "YES" : "NO"),
+ (net->vio ? "YES" : "NO")));
DBUG_VOID_RETURN;
+ }
buff[0]=0; // No fields
pos=net_store_length(buff+1,(ulonglong) affected_rows);
--- 1.241/sql/sql_class.h Tue Jun 21 17:18:22 2005
+++ 1.242/sql/sql_class.h Wed Jun 22 15:37:18 2005
@@ -1433,10 +1433,10 @@
};
#define tmp_disable_binlog(A) \
- ulong save_options= (A)->options; \
+ {ulong tmp_disable_binlog__save_options= (A)->options; \
(A)->options&= ~OPTION_BIN_LOG;
-#define reenable_binlog(A) (A)->options= save_options;
+#define reenable_binlog(A) (A)->options= tmp_disable_binlog__save_options;};
/* Flags for the THD::system_thread (bitmap) variable */
#define SYSTEM_THREAD_DELAYED_INSERT 1
--- 1.13/mysql-test/r/sp-security.result Tue May 17 11:50:38 2005
+++ 1.14/mysql-test/r/sp-security.result Wed Jun 22 15:37:18 2005
@@ -194,3 +194,20 @@
drop database sptest;
delete from mysql.user where user='usera' or user='userb' or user='userc';
delete from mysql.procs_priv where user='usera' or user='userb' or user='userc';
+drop function if exists bug_9503;
+create database mysqltest//
+use mysqltest//
+create table t1 (s1 int)//
+grant select on t1 to user1@localhost//
+create function bug_9503 () returns int sql security invoker begin declare v int;
+select min(s1) into v from t1; return v; end//
+use mysqltest;
+select bug_9503();
+ERROR 42000: execute command denied to user 'user1'@'localhost' for routine 'mysqltest.bug_9503'
+grant execute on function bug_9503 to user1@localhost;
+do 1;
+use test;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
+drop function bug_9503;
+use test;
+drop database mysqltest;
--- 1.15/mysql-test/t/sp-security.test Tue May 17 11:50:39 2005
+++ 1.16/mysql-test/t/sp-security.test Wed Jun 22 15:37:18 2005
@@ -304,3 +304,39 @@
delete from mysql.user where user='usera' or user='userb' or user='userc';
delete from mysql.procs_priv where user='usera' or user='userb' or user='userc';
+#
+# BUG#9503: reseting correct parameters of thread after error in SP function
+#
+connect (root,localhost,root,,test);
+connection root;
+
+--disable_warnings
+drop function if exists bug_9503;
+--enable_warnings
+delimiter //;
+create database mysqltest//
+use mysqltest//
+create table t1 (s1 int)//
+grant select on t1 to user1@localhost//
+create function bug_9503 () returns int sql security invoker begin declare v int;
+select min(s1) into v from t1; return v; end//
+delimiter ;//
+
+connect (user1,localhost,user1,,test);
+connection user1;
+use mysqltest;
+-- error 1370
+select bug_9503();
+
+connection root;
+grant execute on function bug_9503 to user1@localhost;
+
+connection user1;
+do 1;
+use test;
+
+connection root;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
+drop function bug_9503;
+use test;
+drop database mysqltest;
| Thread |
|---|
| • bk commit into 5.0 tree (bell:1.1981) BUG#9503 | sanja | 22 Jun |