=== modified file 'mysql-test/r/grant.result' --- mysql-test/r/grant.result 2011-03-21 14:22:13 +0000 +++ mysql-test/r/grant.result 2015-02-09 13:33:35 +0000 @@ -777,6 +777,7 @@ Grants for mysqltest1@192.% GRANT USAGE ON *.* TO 'mysqltest1'@'192.%' GRANT SELECT ON `mysqltest`.`t1` TO 'mysqltest1'@'192.%' +GRANT DELETE ON `mysqltest`.`t1` TO 'mysqltest1'@'%' show grants for mysqltest1@'%'; Grants for mysqltest1@% GRANT USAGE ON *.* TO 'mysqltest1'@'%' @@ -832,6 +833,7 @@ Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'%' +GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'' select * from information_schema.schema_privileges where grantee like "'mysqltest_8'%"; GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE @@ -871,6 +873,7 @@ show grants for mysqltest_8@''; Grants for mysqltest_8@ GRANT USAGE ON *.* TO 'mysqltest_8'@'' +GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%' GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'' show grants for mysqltest_8; Grants for mysqltest_8@% @@ -880,11 +883,13 @@ show grants for mysqltest_8@''; Grants for mysqltest_8@ GRANT USAGE ON *.* TO 'mysqltest_8'@'' +GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%' GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%' +GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'' select * from information_schema.column_privileges; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE 'mysqltest_8'@'%' def test t1 a UPDATE NO @@ -914,6 +919,7 @@ show grants for mysqltest_8@''; Grants for mysqltest_8@ GRANT USAGE ON *.* TO 'mysqltest_8'@'' +GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%' GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'' show grants for mysqltest_8; Grants for mysqltest_8@% @@ -923,11 +929,13 @@ show grants for mysqltest_8@''; Grants for mysqltest_8@ GRANT USAGE ON *.* TO 'mysqltest_8'@'' +GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%' GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%' +GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'' select * from information_schema.table_privileges; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE 'mysqltest_8'@'%' def test t1 UPDATE NO @@ -960,12 +968,14 @@ show grants for mysqltest_8@''; Grants for mysqltest_8@ GRANT USAGE ON *.* TO 'mysqltest_8'@'' +GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%' GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'' GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%' +GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'' select * from information_schema.user_privileges where grantee like "'mysqltest_8'%"; GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE @@ -978,12 +988,15 @@ show grants for mysqltest_8@''; Grants for mysqltest_8@ GRANT USAGE ON *.* TO 'mysqltest_8'@'' +GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%' GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'' GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'' show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO 'mysqltest_8'@'%' GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%' +GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'' +GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'' drop user mysqltest_8@''; show grants for mysqltest_8@''; ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '' === modified file 'mysql-test/r/grant_cache_no_prot.result' --- mysql-test/r/grant_cache_no_prot.result 2010-08-09 08:32:50 +0000 +++ mysql-test/r/grant_cache_no_prot.result 2015-02-09 13:33:35 +0000 @@ -121,6 +121,8 @@ show grants for current_user(); Grants for @localhost GRANT USAGE ON *.* TO ''@'localhost' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER ON `test`.* TO ''@'%' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER ON `test\_%`.* TO ''@'%' ----- establish connection user2 (user=mysqltest_2) ----- select "user2"; user2 === added file 'mysql-test/r/percona_bug1354988.result' --- mysql-test/r/percona_bug1354988.result 1970-01-01 00:00:00 +0000 +++ mysql-test/r/percona_bug1354988.result 2015-02-09 13:33:35 +0000 @@ -0,0 +1,50 @@ +CREATE USER grantee@localhost IDENTIFIED BY 'grantee1'; +CREATE USER grantee IDENTIFIED BY 'grantee2'; +CREATE DATABASE db2; +CREATE DATABASE db3; +USE db3; +CREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL DEFAULT 0); +CREATE TABLE t2 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL DEFAULT 0); +INSERT INTO t2 (b) VALUES (1), (2); +CREATE FUNCTION f1() RETURNS INT +BEGIN +RETURN 1; +END | +CREATE PROCEDURE p1() +BEGIN +SELECT 1; +END | +GRANT ALL PRIVILEGES ON db2.* TO grantee WITH GRANT OPTION; +GRANT SELECT(a) ON TABLE db3.t2 TO grantee WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON TABLE db3.t1 TO grantee WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON FUNCTION db3.f1 TO grantee WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON PROCEDURE db3.p1 TO grantee WITH GRANT OPTION; +SELECT user(), current_user(); +user() current_user() +grantee@localhost grantee@localhost +SHOW GRANTS; +Grants for grantee@localhost +GRANT USAGE ON *.* TO 'grantee'@'localhost' IDENTIFIED BY PASSWORD '*9823FF338D44DAF02422CF24DD1F879FB4F6B232' +GRANT ALL PRIVILEGES ON `db2`.* TO 'grantee'@'%' WITH GRANT OPTION +GRANT SELECT (a) ON `db3`.`t2` TO 'grantee'@'%' WITH GRANT OPTION +GRANT ALL PRIVILEGES ON `db3`.`t1` TO 'grantee'@'%' WITH GRANT OPTION +GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `db3`.`p1` TO 'grantee'@'%' WITH GRANT OPTION +GRANT EXECUTE, ALTER ROUTINE ON FUNCTION `db3`.`f1` TO 'grantee'@'%' WITH GRANT OPTION +USE db2; +CREATE TABLE t1(f1 int); +USE db3; +SELECT a FROM t2; +a +1 +2 +INSERT INTO t1 (b) VALUES (1), (2); +SELECT f1(); +f1() +1 +CALL p1(); +1 +1 +DROP DATABASE db2; +DROP DATABASE db3; +DROP USER grantee@localhost; +DROP USER grantee; === added file 'mysql-test/t/percona_bug1354988.test' --- mysql-test/t/percona_bug1354988.test 1970-01-01 00:00:00 +0000 +++ mysql-test/t/percona_bug1354988.test 2015-02-09 13:33:35 +0000 @@ -0,0 +1,53 @@ +# The bug #1354988 test. + +CREATE USER grantee@localhost IDENTIFIED BY 'grantee1'; +CREATE USER grantee IDENTIFIED BY 'grantee2'; + +CREATE DATABASE db2; + + +CREATE DATABASE db3; +USE db3; + +CREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL DEFAULT 0); +CREATE TABLE t2 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL DEFAULT 0); +INSERT INTO t2 (b) VALUES (1), (2); + +-- delimiter | + +CREATE FUNCTION f1() RETURNS INT +BEGIN + RETURN 1; +END | + +CREATE PROCEDURE p1() +BEGIN + SELECT 1; +END | + +-- delimiter ; + +GRANT ALL PRIVILEGES ON db2.* TO grantee WITH GRANT OPTION; +GRANT SELECT(a) ON TABLE db3.t2 TO grantee WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON TABLE db3.t1 TO grantee WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON FUNCTION db3.f1 TO grantee WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON PROCEDURE db3.p1 TO grantee WITH GRANT OPTION; + +-- connect (con1, localhost, grantee,grantee1,) +-- connection con1 +SELECT user(), current_user(); +SHOW GRANTS; +USE db2; +CREATE TABLE t1(f1 int); +USE db3; +SELECT a FROM t2; +INSERT INTO t1 (b) VALUES (1), (2); +SELECT f1(); +CALL p1(); +-- disconnect con1 + +-- connection default +DROP DATABASE db2; +DROP DATABASE db3; +DROP USER grantee@localhost; +DROP USER grantee; === modified file 'sql/sql_acl.cc' --- sql/sql_acl.cc 2014-06-30 13:54:25 +0000 +++ sql/sql_acl.cc 2015-02-09 13:33:35 +0000 @@ -5413,7 +5413,7 @@ */ if (!strcmp(lex_user->user.str,user) && - !my_strcasecmp(system_charset_info, lex_user->host.str, host)) + compare_hostname(&acl_db->host, lex_user->host.str, lex_user->host.str)) { want_access=acl_db->access; if (want_access) @@ -5483,7 +5483,9 @@ */ if (!strcmp(lex_user->user.str,user) && - !my_strcasecmp(system_charset_info, lex_user->host.str, host)) + compare_hostname(&grant_table->host, + lex_user->host.str, + lex_user->host.str)) { ulong table_access= grant_table->privs; if ((table_access | grant_table->cols) != 0) @@ -5632,7 +5634,9 @@ */ if (!strcmp(lex_user->user.str,user) && - !my_strcasecmp(system_charset_info, lex_user->host.str, host)) + compare_hostname(&grant_proc->host, + lex_user->host.str, + lex_user->host.str)) { ulong proc_access= grant_proc->privs; if (proc_access != 0)