mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
fixed environment restoring in case of error during SP function execution (BUG#9503)
#define macro improvement mysql-test/r/sp-security.result: BUG#9503: reseting correct parameters of thread after error in SP function mysql-test/t/sp-security.test: BUG#9503: reseting correct parameters of thread after error in SP function sql/item_func.cc: fixed environment restoring in case of error during SP function execution sql/protocol.cc: added debug print sql/sql_class.h: fixed #defines to force them to be alvaise in piar, and variable name made more complex for accident repeating in other code
This commit is contained in:
@ -194,3 +194,20 @@ use test;
|
||||
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;
|
||||
|
@ -304,3 +304,39 @@ 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';
|
||||
|
||||
#
|
||||
# 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;
|
||||
|
Reference in New Issue
Block a user