Below is the list of changes that have just been committed into a local
5.0 repository of alik. When alik 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.2029 05/10/10 15:15:10 anozdrin@stripped +4 -0
Fix for Bug#13198 "SP executes if definer does not exist"
sql/share/errmsg.txt
1.50 05/10/10 15:15:04 anozdrin@stripped +1 -1
Fix typo
sql/item_func.cc
1.257 05/10/10 15:15:04 anozdrin@stripped +3 -1
Bug#13198: do not execute stored function if user context
can not be switched (definer does not exist).
mysql-test/t/sp-security.test
1.24 05/10/10 15:15:04 anozdrin@stripped +96 -0
Test case for Bug#13198.
mysql-test/r/sp-security.result
1.22 05/10/10 15:15:04 anozdrin@stripped +49 -0
Results for the test case for Bug#13198.
# 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: anozdrin
# Host: station.home
# Root: /home/alik/Documents/AllProgs/MySQL/devel/5.0-bug13198
--- 1.256/sql/item_func.cc 2005-09-21 16:36:53 +04:00
+++ 1.257/sql/item_func.cc 2005-10-10 15:15:04 +04:00
@@ -4887,7 +4887,9 @@
goto error;
}
- sp_change_security_context(thd, m_sp, save);
+ if (sp_change_security_context(thd, m_sp, save))
+ goto error;
+
if (*save &&
check_routine_access(thd, want_access,
m_sp->m_db.str, m_sp->m_name.str, 0, FALSE))
--- 1.49/sql/share/errmsg.txt 2005-10-05 21:58:04 +04:00
+++ 1.50/sql/share/errmsg.txt 2005-10-10 15:15:04 +04:00
@@ -5413,7 +5413,7 @@
ER_VIEW_OTHER_USER
eng "You need the SUPER privilege for creation view with %-.64s@%-.64s definer"
ER_NO_SUCH_USER
- eng "There is not %-.64s@%-.64s registered"
+ eng "There is no %-.64s@%-.64s registered"
ER_FORBID_SCHEMA_CHANGE
eng "Changing schema from '%-.64s' to '%-.64s' is not allowed."
ER_ROW_IS_REFERENCED_2 23000
--- 1.21/mysql-test/r/sp-security.result 2005-10-03 21:00:47 +04:00
+++ 1.22/mysql-test/r/sp-security.result 2005-10-10 15:15:04 +04:00
@@ -251,3 +251,52 @@
drop database mysqltest_1;
revoke usage on *.* from mysqltest_1@localhost;
drop user mysqltest_1@localhost;
+
+--> connection: bug13198_root_con
+CREATE USER bug13198_u1@localhost;
+CREATE USER bug13198_u2@localhost;
+GRANT ALL PRIVILEGES ON test.* TO bug13198_u1@localhost;
+GRANT ALL PRIVILEGES ON test.* TO bug13198_u2@localhost;
+
+--> connection: bug13198_u1_con
+DROP PROCEDURE IF EXISTS bug13198_p1;
+Warnings:
+Note 1305 PROCEDURE bug13198_p1 does not exist
+CREATE PROCEDURE bug13198_p1()
+BEGIN
+SELECT 1;
+END|
+CREATE FUNCTION bug13198_f1() RETURNS INT
+BEGIN
+RETURN 1;
+END|
+CALL bug13198_p1();
+1
+1
+SELECT bug13198_f1();
+bug13198_f1()
+1
+
+--> connection: bug13198_u2_con
+CALL bug13198_p1();
+1
+1
+SELECT bug13198_f1();
+bug13198_f1()
+1
+
+--> connection: bug13198_root_con
+DROP USER bug13198_u1@localhost;
+
+--> connection: bug13198_u2_con
+use test;
+CALL bug13198_p1();
+ERROR HY000: There is not bug13198_u1@localhost registered
+SELECT bug13198_f1();
+ERROR HY000: There is not bug13198_u1@localhost registered
+
+--> connection: bug13198_root_test_con
+DROP PROCEDURE bug13198_p1;
+DROP FUNCTION bug13198_f1;
+
+--> connection: default
--- 1.23/mysql-test/t/sp-security.test 2005-10-03 21:00:49 +04:00
+++ 1.24/mysql-test/t/sp-security.test 2005-10-10 15:15:04 +04:00
@@ -413,3 +413,99 @@
drop user mysqltest_1@localhost;
# End of 5.0 bugs.
+
+#
+# Bug #13198 SP executes if definer does not exist
+#
+
+# Prepare environment under root.
+
+--connect (bug13198_root_con,localhost,root,,mysql)
+--echo
+--echo --> connection: bug13198_root_con
+--connection bug13198_root_con
+
+CREATE USER bug13198_u1@localhost;
+CREATE USER bug13198_u2@localhost;
+
+GRANT ALL PRIVILEGES ON test.* TO bug13198_u1@localhost;
+GRANT ALL PRIVILEGES ON test.* TO bug13198_u2@localhost;
+
+# Create a procedure/function under u1.
+
+--connect (bug13198_u1_con,localhost,bug13198_u1,,test)
+--echo
+--echo --> connection: bug13198_u1_con
+--connection bug13198_u1_con
+
+DROP PROCEDURE IF EXISTS bug13198_p1;
+
+delimiter |;
+
+CREATE PROCEDURE bug13198_p1()
+BEGIN
+ SELECT 1;
+END|
+
+CREATE FUNCTION bug13198_f1() RETURNS INT
+BEGIN
+ RETURN 1;
+END|
+
+delimiter ;|
+
+CALL bug13198_p1();
+
+SELECT bug13198_f1();
+
+--disconnect bug13198_u1_con
+
+# Check that u2 can call the procedure/function.
+
+--connect (bug13198_u2_con,localhost,bug13198_u2,,test)
+--echo
+--echo --> connection: bug13198_u2_con
+--connection bug13198_u2_con
+
+CALL bug13198_p1();
+
+SELECT bug13198_f1();
+
+# Drop user u1 (definer of the object);
+
+--echo
+--echo --> connection: bug13198_root_con
+--connection bug13198_root_con
+
+DROP USER bug13198_u1@localhost;
+
+# Check that u2 can not call the procedure/function.
+
+--echo
+--echo --> connection: bug13198_u2_con
+--connection bug13198_u2_con
+
+use test;
+
+--error ER_NO_SUCH_USER
+CALL bug13198_p1();
+
+--error ER_NO_SUCH_USER
+SELECT bug13198_f1();
+
+# Cleanup.
+
+--echo
+--connect (bug13198_root_test_con,localhost,root,,test)
+--echo --> connection: bug13198_root_test_con
+--connection bug13198_root_test_con
+
+DROP PROCEDURE bug13198_p1;
+DROP FUNCTION bug13198_f1;
+
+--echo
+--echo --> connection: default
+--connection default
+--disconnect bug13198_root_con
+--disconnect bug13198_u2_con
+--disconnect bug13198_root_test_con
| Thread |
|---|
| • bk commit into 5.0 tree (anozdrin:1.2029) BUG#13198 | Alexander Nozdrin | 10 Oct |