1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Bug #48872 : Privileges for stored functions ignored if function name

is mixed case

Transcode the procedure name to lowercase when searching for it in the 
hash. This is the missing part of the fix for bug #41049.
This commit is contained in:
Georgi Kodinov
2009-11-27 11:59:44 +02:00
parent e2afa05e2a
commit 0ed9d7e76c
3 changed files with 126 additions and 5 deletions

View File

@ -519,4 +519,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.