diff options
author | Dmitry Lenev <Dmitry.Lenev@oracle.com> | 2017-02-23 12:41:13 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-02-27 12:35:10 +0100 |
commit | 494a94158a6f509afad1078615679c51b723b7a6 (patch) | |
tree | 8f758d150bb6e94600624744e366b89cb714a497 /mysql-test/r/grant.result | |
parent | 0a480f03c64c7f8ffaef40b49a62d194d4aa6a04 (diff) | |
download | mariadb-git-494a94158a6f509afad1078615679c51b723b7a6.tar.gz |
Fix for bug#11759114 - '51401: GRANT TREATS NONEXISTENT
FUNCTIONS/PRIVILEGES DIFFERENTLY'.
The problem was that attempt to grant EXECUTE or ALTER
ROUTINE privilege on stored procedure which didn't exist
succeed instead of returning an appropriate error like
it happens in similar situation for stored functions or
tables.
The code which handles granting of privileges on individual
routine calls sp_exist_routines() function to check if routine
exists and assumes that the 3rd parameter of the latter
specifies whether it should check for existence of stored
procedure or function. In practice, this parameter had
completely different meaning and, as result, this check was
not done properly for stored procedures.
This fix addresses this problem by bringing sp_exist_routines()
signature and code in line with expectation of its caller.
Diffstat (limited to 'mysql-test/r/grant.result')
-rw-r--r-- | mysql-test/r/grant.result | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index f3910b67dd3..399f8964c2f 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1701,6 +1701,7 @@ Assigning privileges without procs_priv table. CREATE DATABASE mysqltest1; CREATE PROCEDURE mysqltest1.test() SQL SECURITY DEFINER SELECT 1; +CREATE FUNCTION mysqltest1.test() RETURNS INT RETURN 1; GRANT EXECUTE ON FUNCTION mysqltest1.test TO mysqltest_1@localhost; ERROR 42S02: Table 'mysql.procs_priv' doesn't exist GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost; @@ -2537,3 +2538,25 @@ DROP USER mysqltest_u1@localhost; # End of Bug#38347. +# +# BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES +# DIFFERENTLY'. +# +drop database if exists mysqltest_db1; +create database mysqltest_db1; +create user mysqltest_u1; +# Both GRANT statements below should fail with the same error. +grant execute on function mysqltest_db1.f1 to mysqltest_u1; +ERROR 42000: FUNCTION or PROCEDURE f1 does not exist +grant execute on procedure mysqltest_db1.p1 to mysqltest_u1; +ERROR 42000: FUNCTION or PROCEDURE p1 does not exist +# Let us show that GRANT behaviour for routines is consistent +# with GRANT behaviour for tables. Attempt to grant privilege +# on non-existent table also results in an error. +grant select on mysqltest_db1.t1 to mysqltest_u1; +ERROR 42S02: Table 'mysqltest_db1.t1' doesn't exist +show grants for mysqltest_u1; +Grants for mysqltest_u1@% +GRANT USAGE ON *.* TO 'mysqltest_u1'@'%' +drop database mysqltest_db1; +drop user mysqltest_u1; |