summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-11-27 12:32:15 +0200
committerGeorgi Kodinov <joro@sun.com>2009-11-27 12:32:15 +0200
commit3ac63ae8f5b0ebfd0e9981ace6478876dc0902cd (patch)
treefbc183ff75ed1cc0f31743484dcba573cd03d1ef /mysql-test
parenta0adcf508c04cd666cc1e519dd17797cc1f802c7 (diff)
parentc86aa7e04edff7c03fac6f69abe652f7c7157c10 (diff)
downloadmariadb-git-3ac63ae8f5b0ebfd0e9981ace6478876dc0902cd.tar.gz
merge
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/sp-security.result61
-rw-r--r--mysql-test/t/sp-security.test57
2 files changed, 118 insertions, 0 deletions
diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result
index 65c94577a57..5f1d9b94277 100644
--- a/mysql-test/r/sp-security.result
+++ b/mysql-test/r/sp-security.result
@@ -510,4 +510,65 @@ DROP USER mysqltest_u1@localhost;
DROP PROCEDURE p_suid;
DROP FUNCTION f_suid;
DROP TABLE t1;
+#
+# Bug #48872 : Privileges for stored functions ignored if function name
+# is mixed case
+#
+CREATE DATABASE B48872;
+USE B48872;
+CREATE TABLE `TestTab` (id INT);
+INSERT INTO `TestTab` VALUES (1),(2);
+CREATE FUNCTION `f_Test`() RETURNS INT RETURN 123;
+CREATE FUNCTION `f_Test_denied`() RETURNS INT RETURN 123;
+CREATE USER 'tester';
+CREATE USER 'Tester';
+GRANT SELECT ON TABLE `TestTab` TO 'tester';
+GRANT EXECUTE ON FUNCTION `f_Test` TO 'tester';
+GRANT EXECUTE ON FUNCTION `f_Test_denied` TO 'Tester';
+SELECT f_Test();
+f_Test()
+123
+SELECT * FROM TestTab;
+id
+1
+2
+SELECT * FROM TestTab;
+id
+1
+2
+SELECT `f_Test`();
+`f_Test`()
+123
+SELECT `F_TEST`();
+`F_TEST`()
+123
+SELECT f_Test();
+f_Test()
+123
+SELECT F_TEST();
+F_TEST()
+123
+SELECT * FROM TestTab;
+ERROR 42000: SELECT command denied to user 'Tester'@'localhost' for table 'TestTab'
+SELECT `f_Test`();
+ERROR 42000: execute command denied to user 'Tester'@'%' for routine 'B48872.f_Test'
+SELECT `F_TEST`();
+ERROR 42000: execute command denied to user 'Tester'@'%' for routine 'B48872.f_Test'
+SELECT f_Test();
+ERROR 42000: execute command denied to user 'Tester'@'%' for routine 'B48872.f_Test'
+SELECT F_TEST();
+ERROR 42000: execute command denied to user 'Tester'@'%' for routine 'B48872.f_Test'
+SELECT `f_Test_denied`();
+`f_Test_denied`()
+123
+SELECT `F_TEST_DENIED`();
+`F_TEST_DENIED`()
+123
+DROP TABLE `TestTab`;
+DROP FUNCTION `f_Test`;
+DROP FUNCTION `f_Test_denied`;
+USE test;
+DROP USER 'tester';
+DROP USER 'Tester';
+DROP DATABASE B48872;
End of 5.0 tests.
diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test
index a80fe89082a..5e8c75a72e2 100644
--- a/mysql-test/t/sp-security.test
+++ b/mysql-test/t/sp-security.test
@@ -865,6 +865,63 @@ DROP PROCEDURE p_suid;
DROP FUNCTION f_suid;
DROP TABLE t1;
+--echo #
+--echo # Bug #48872 : Privileges for stored functions ignored if function name
+--echo # is mixed case
+--echo #
+
+CREATE DATABASE B48872;
+USE B48872;
+CREATE TABLE `TestTab` (id INT);
+INSERT INTO `TestTab` VALUES (1),(2);
+CREATE FUNCTION `f_Test`() RETURNS INT RETURN 123;
+CREATE FUNCTION `f_Test_denied`() RETURNS INT RETURN 123;
+CREATE USER 'tester';
+CREATE USER 'Tester';
+GRANT SELECT ON TABLE `TestTab` TO 'tester';
+GRANT EXECUTE ON FUNCTION `f_Test` TO 'tester';
+GRANT EXECUTE ON FUNCTION `f_Test_denied` TO 'Tester';
+
+SELECT f_Test();
+SELECT * FROM TestTab;
+
+CONNECT (con_tester,localhost,tester,,B48872);
+CONNECT (con_tester_denied,localhost,Tester,,B48872);
+CONNECTION con_tester;
+
+SELECT * FROM TestTab;
+SELECT `f_Test`();
+SELECT `F_TEST`();
+SELECT f_Test();
+SELECT F_TEST();
+
+CONNECTION con_tester_denied;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM TestTab;
+--error ER_PROCACCESS_DENIED_ERROR
+SELECT `f_Test`();
+--error ER_PROCACCESS_DENIED_ERROR
+SELECT `F_TEST`();
+--error ER_PROCACCESS_DENIED_ERROR
+SELECT f_Test();
+--error ER_PROCACCESS_DENIED_ERROR
+SELECT F_TEST();
+SELECT `f_Test_denied`();
+SELECT `F_TEST_DENIED`();
+
+CONNECTION default;
+DISCONNECT con_tester;
+DISCONNECT con_tester_denied;
+DROP TABLE `TestTab`;
+DROP FUNCTION `f_Test`;
+DROP FUNCTION `f_Test_denied`;
+
+USE test;
+DROP USER 'tester';
+DROP USER 'Tester';
+DROP DATABASE B48872;
+
--echo End of 5.0 tests.
# Wait till all disconnects are completed