=== modified file 'mysql-test/r/grant.result' --- mysql-test/r/grant.result 2013-09-13 02:29:30 +0000 +++ mysql-test/r/grant.result 2015-02-13 06:42:09 +0000 @@ -781,6 +781,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'@'%' @@ -836,6 +837,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 @@ -875,6 +877,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@% @@ -884,11 +887,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 @@ -918,6 +923,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@% @@ -927,11 +933,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 @@ -964,12 +972,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 @@ -982,12 +992,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.result' --- mysql-test/r/grant_cache.result 2012-05-09 15:11:24 +0000 +++ mysql-test/r/grant_cache.result 2015-02-13 06:42:09 +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; === modified file 'mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result' --- mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result 2013-04-19 08:36:00 +0000 +++ mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result 2015-02-13 06:42:09 +0000 @@ -203,6 +203,8 @@ SHOW GRANTS; Grants for @localhost GRANT PROCESS 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 ''@'%' SHOW processlist; Id User Host db Command Time State Info ID HOST_NAME information_schema Query TIME init SHOW processlist @@ -251,6 +253,8 @@ SHOW GRANTS FOR ''@'localhost'; 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 ''@'%' SELECT * FROM information_schema.processlist; ID USER HOST DB COMMAND TIME STATE INFO ID HOST_NAME information_schema Query TIME executing SELECT * FROM information_schema.processlist === 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:57:01 +0000 +++ sql/sql_acl.cc 2015-02-13 06:42:09 +0000 @@ -6652,7 +6652,7 @@ */ if (!strcmp(lex_user->user.str,user) && - !my_strcasecmp(system_charset_info, lex_user->host.str, host)) + acl_db->host.compare_hostname(lex_user->host.str, lex_user->host.str)) { want_access=acl_db->access; if (want_access) @@ -6722,7 +6722,8 @@ */ if (!strcmp(lex_user->user.str,user) && - !my_strcasecmp(system_charset_info, lex_user->host.str, host)) + grant_table->host.compare_hostname(lex_user->host.str, + lex_user->host.str)) { ulong table_access= grant_table->privs; if ((table_access | grant_table->cols) != 0) @@ -6871,7 +6872,8 @@ */ if (!strcmp(lex_user->user.str,user) && - !my_strcasecmp(system_charset_info, lex_user->host.str, host)) + grant_proc->host.compare_hostname(lex_user->host.str, + lex_user->host.str)) { ulong proc_access= grant_proc->privs; if (proc_access != 0)