Description:
If there is exist a function with definer root, user with grants ALL on particular database this user can execute this function. But after it reconnects it can not execute the function until it tries to get information about it.
mysql-next-mr does not have this problem.
How to repeat:
GRANT SHOW DATABASES ON *.* TO 'basic'@'localhost';
GRANT ALL PRIVILEGES ON `MyDatabase 1.0.1.0`.* TO 'basic'@'localhost';
create database `MyDatabase 1.0.1.0`;
use `MyDatabase 1.0.1.0`;
delimiter |;
CREATE FUNCTION testbug10310ag(a float, b bigint, c int) RETURNS INT NO SQL
BEGIN
RETURN a;
END
|
delimiter ;|
select connection_id();
connect (addconbasic, localhost, basic,,);
connection addconbasic;
use `MyDatabase 1.0.1.0`;
--disable_abort_on_error
show function status like "testbug10310ag";
show create function "testbug10310ag";
show create function "MyDatabase 1.0.1.0"."testbug10310ag";
show create function `MyDatabase 1.0.1.0`.`testbug10310ag`;
show create function testbug10310ag;
SELECT testbug10310ag(2.0,1,1);
SELECT `MyDatabase 1.0.1.0`.testbug10310ag(2.0,1,1);
SELECT `MyDatabase 1.0.1.0`.`testbug10310ag`(2.0,1,1);
disconnect addconbasic;
connect (addconbasic, localhost, basic,,);
connection addconbasic;
use `MyDatabase 1.0.1.0`;
SELECT testbug10310ag(2.0,1,1);
SELECT `MyDatabase 1.0.1.0`.testbug10310ag(2.0,1,1);
SELECT `MyDatabase 1.0.1.0`.`testbug10310ag`(2.0,1,1);
show function status like "testbug10310ag";
show create function "testbug10310ag";
show create function "MyDatabase 1.0.1.0"."testbug10310ag";
show create function `MyDatabase 1.0.1.0`.`testbug10310ag`;
show create function testbug10310ag;
SELECT testbug10310ag(2.0,1,1);
SELECT `MyDatabase 1.0.1.0`.testbug10310ag(2.0,1,1);
SELECT `MyDatabase 1.0.1.0`.`testbug10310ag`(2.0,1,1);
Last part of output:
SELECT testbug10310ag(2.0,1,1);
testbug10310ag(2.0,1,1)
2
SELECT `MyDatabase 1.0.1.0`.testbug10310ag(2.0,1,1);
`MyDatabase 1.0.1.0`.testbug10310ag(2.0,1,1)
2
SELECT `MyDatabase 1.0.1.0`.`testbug10310ag`(2.0,1,1);
`MyDatabase 1.0.1.0`.`testbug10310ag`(2.0,1,1)
2
connect(localhost,basic,,test,13000,/Users/apple/bzr/mysql-5.1/mysql-test/var/tmp/mysqld.1.sock);
use `MyDatabase 1.0.1.0`;
SELECT testbug10310ag(2.0,1,1);
ERROR 42000: FUNCTION mydatabase 1.0.1.0.testbug10310ag does not exist
SELECT `MyDatabase 1.0.1.0`.testbug10310ag(2.0,1,1);
ERROR 42000: FUNCTION MyDatabase 1.0.1.0.testbug10310ag does not exist
SELECT `MyDatabase 1.0.1.0`.`testbug10310ag`(2.0,1,1);
ERROR 42000: FUNCTION MyDatabase 1.0.1.0.testbug10310ag does not exist
show function status like "testbug10310ag";
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
mydatabase 1.0.1.0 testbug10310ag FUNCTION root@localhost 2010-09-02 20:13:10 2010-09-02 20:13:10 DEFINER latin1 latin1_swedish_ci utf8_general_ci
show create function "testbug10310ag";
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"testbug10310ag"' at line 1
show create function "MyDatabase 1.0.1.0"."testbug10310ag";
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"MyDatabase 1.0.1.0"."testbug10310ag"' at line 1
show create function `MyDatabase 1.0.1.0`.`testbug10310ag`;
Function sql_mode Create