Merge lp:~vlad-lesin/percona-server/5.6-bug-1354988 into lp:percona-server/5.6

Proposed by Vlad Lesin
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: no longer in the source branch.
Merged at revision: 743
Proposed branch: lp:~vlad-lesin/percona-server/5.6-bug-1354988
Merge into: lp:percona-server/5.6
Diff against target: 275 lines (+127/-3)
6 files modified
mysql-test/r/grant.result (+13/-0)
mysql-test/r/grant_cache.result (+2/-0)
mysql-test/r/percona_bug1354988.result (+50/-0)
mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result (+4/-0)
mysql-test/t/percona_bug1354988.test (+53/-0)
sql/sql_acl.cc (+5/-3)
To merge this branch: bzr merge lp:~vlad-lesin/percona-server/5.6-bug-1354988
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Review via email: mp+246278@code.launchpad.net

Description of the change

Bug #1354988 fix.

Use compare_hostname() function instead of my_strcasecmp() in mysql_show_grants().

To post a comment you must log in.
Revision history for this message
Vlad Lesin (vlad-lesin) wrote :
Revision history for this message
Vlad Lesin (vlad-lesin) wrote :
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'mysql-test/r/grant.result'
--- mysql-test/r/grant.result 2014-12-01 07:53:48 +0000
+++ mysql-test/r/grant.result 2015-02-09 13:07:26 +0000
@@ -781,6 +781,7 @@
781Grants for mysqltest1@192.%781Grants for mysqltest1@192.%
782GRANT USAGE ON *.* TO 'mysqltest1'@'192.%'782GRANT USAGE ON *.* TO 'mysqltest1'@'192.%'
783GRANT SELECT ON `mysqltest`.`t1` TO 'mysqltest1'@'192.%'783GRANT SELECT ON `mysqltest`.`t1` TO 'mysqltest1'@'192.%'
784GRANT DELETE ON `mysqltest`.`t1` TO 'mysqltest1'@'%'
784show grants for mysqltest1@'%';785show grants for mysqltest1@'%';
785Grants for mysqltest1@%786Grants for mysqltest1@%
786GRANT USAGE ON *.* TO 'mysqltest1'@'%'787GRANT USAGE ON *.* TO 'mysqltest1'@'%'
@@ -836,6 +837,7 @@
836Grants for mysqltest_8@%837Grants for mysqltest_8@%
837GRANT USAGE ON *.* TO 'mysqltest_8'@'%'838GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
838GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'%'839GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'%'
840GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@''
839select * from information_schema.schema_privileges841select * from information_schema.schema_privileges
840where grantee like "'mysqltest_8'%";842where grantee like "'mysqltest_8'%";
841GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE843GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
@@ -875,6 +877,7 @@
875show grants for mysqltest_8@'';877show grants for mysqltest_8@'';
876Grants for mysqltest_8@878Grants for mysqltest_8@
877GRANT USAGE ON *.* TO 'mysqltest_8'@''879GRANT USAGE ON *.* TO 'mysqltest_8'@''
880GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%'
878GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''881GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
879show grants for mysqltest_8;882show grants for mysqltest_8;
880Grants for mysqltest_8@%883Grants for mysqltest_8@%
@@ -884,11 +887,13 @@
884show grants for mysqltest_8@'';887show grants for mysqltest_8@'';
885Grants for mysqltest_8@888Grants for mysqltest_8@
886GRANT USAGE ON *.* TO 'mysqltest_8'@''889GRANT USAGE ON *.* TO 'mysqltest_8'@''
890GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%'
887GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''891GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
888show grants for mysqltest_8;892show grants for mysqltest_8;
889Grants for mysqltest_8@%893Grants for mysqltest_8@%
890GRANT USAGE ON *.* TO 'mysqltest_8'@'%'894GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
891GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%'895GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%'
896GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
892select * from information_schema.column_privileges;897select * from information_schema.column_privileges;
893GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE898GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
894'mysqltest_8'@'%' def test t1 a UPDATE NO899'mysqltest_8'@'%' def test t1 a UPDATE NO
@@ -918,6 +923,7 @@
918show grants for mysqltest_8@'';923show grants for mysqltest_8@'';
919Grants for mysqltest_8@924Grants for mysqltest_8@
920GRANT USAGE ON *.* TO 'mysqltest_8'@''925GRANT USAGE ON *.* TO 'mysqltest_8'@''
926GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%'
921GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@''927GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@''
922show grants for mysqltest_8;928show grants for mysqltest_8;
923Grants for mysqltest_8@%929Grants for mysqltest_8@%
@@ -927,11 +933,13 @@
927show grants for mysqltest_8@'';933show grants for mysqltest_8@'';
928Grants for mysqltest_8@934Grants for mysqltest_8@
929GRANT USAGE ON *.* TO 'mysqltest_8'@''935GRANT USAGE ON *.* TO 'mysqltest_8'@''
936GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%'
930GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@''937GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@''
931show grants for mysqltest_8;938show grants for mysqltest_8;
932Grants for mysqltest_8@%939Grants for mysqltest_8@%
933GRANT USAGE ON *.* TO 'mysqltest_8'@'%'940GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
934GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%'941GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%'
942GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@''
935select * from information_schema.table_privileges;943select * from information_schema.table_privileges;
936GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE944GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
937'mysqltest_8'@'%' def test t1 UPDATE NO945'mysqltest_8'@'%' def test t1 UPDATE NO
@@ -964,12 +972,14 @@
964show grants for mysqltest_8@'';972show grants for mysqltest_8@'';
965Grants for mysqltest_8@973Grants for mysqltest_8@
966GRANT USAGE ON *.* TO 'mysqltest_8'@''974GRANT USAGE ON *.* TO 'mysqltest_8'@''
975GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
967GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@''976GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@''
968GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''977GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
969show grants for mysqltest_8;978show grants for mysqltest_8;
970Grants for mysqltest_8@%979Grants for mysqltest_8@%
971GRANT USAGE ON *.* TO 'mysqltest_8'@'%'980GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
972GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'981GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
982GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@''
973select * from information_schema.user_privileges983select * from information_schema.user_privileges
974where grantee like "'mysqltest_8'%";984where grantee like "'mysqltest_8'%";
975GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE985GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
@@ -982,12 +992,15 @@
982show grants for mysqltest_8@'';992show grants for mysqltest_8@'';
983Grants for mysqltest_8@993Grants for mysqltest_8@
984GRANT USAGE ON *.* TO 'mysqltest_8'@''994GRANT USAGE ON *.* TO 'mysqltest_8'@''
995GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
985GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@''996GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@''
986GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''997GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
987show grants for mysqltest_8;998show grants for mysqltest_8;
988Grants for mysqltest_8@%999Grants for mysqltest_8@%
989GRANT USAGE ON *.* TO 'mysqltest_8'@'%'1000GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
990GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'1001GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
1002GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@''
1003GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
991drop user mysqltest_8@'';1004drop user mysqltest_8@'';
992show grants for mysqltest_8@'';1005show grants for mysqltest_8@'';
993ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host ''1006ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host ''
9941007
=== modified file 'mysql-test/r/grant_cache.result'
--- mysql-test/r/grant_cache.result 2014-12-01 07:53:48 +0000
+++ mysql-test/r/grant_cache.result 2015-02-09 13:07:26 +0000
@@ -121,6 +121,8 @@
121show grants for current_user();121show grants for current_user();
122Grants for @localhost122Grants for @localhost
123GRANT USAGE ON *.* TO ''@'localhost'123GRANT USAGE ON *.* TO ''@'localhost'
124GRANT 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 ''@'%'
125GRANT 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 ''@'%'
124----- establish connection user2 (user=mysqltest_2) -----126----- establish connection user2 (user=mysqltest_2) -----
125select "user2";127select "user2";
126user2128user2
127129
=== 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:07:26 +0000
@@ -0,0 +1,50 @@
1CREATE USER grantee@localhost IDENTIFIED BY 'grantee1';
2CREATE USER grantee IDENTIFIED BY 'grantee2';
3CREATE DATABASE db2;
4CREATE DATABASE db3;
5USE db3;
6CREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL DEFAULT 0);
7CREATE TABLE t2 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL DEFAULT 0);
8INSERT INTO t2 (b) VALUES (1), (2);
9CREATE FUNCTION f1() RETURNS INT
10BEGIN
11RETURN 1;
12END |
13CREATE PROCEDURE p1()
14BEGIN
15SELECT 1;
16END |
17GRANT ALL PRIVILEGES ON db2.* TO grantee WITH GRANT OPTION;
18GRANT SELECT(a) ON TABLE db3.t2 TO grantee WITH GRANT OPTION;
19GRANT ALL PRIVILEGES ON TABLE db3.t1 TO grantee WITH GRANT OPTION;
20GRANT ALL PRIVILEGES ON FUNCTION db3.f1 TO grantee WITH GRANT OPTION;
21GRANT ALL PRIVILEGES ON PROCEDURE db3.p1 TO grantee WITH GRANT OPTION;
22SELECT user(), current_user();
23user() current_user()
24grantee@localhost grantee@localhost
25SHOW GRANTS;
26Grants for grantee@localhost
27GRANT USAGE ON *.* TO 'grantee'@'localhost' IDENTIFIED BY PASSWORD '*9823FF338D44DAF02422CF24DD1F879FB4F6B232'
28GRANT ALL PRIVILEGES ON `db2`.* TO 'grantee'@'%' WITH GRANT OPTION
29GRANT SELECT (a) ON `db3`.`t2` TO 'grantee'@'%' WITH GRANT OPTION
30GRANT ALL PRIVILEGES ON `db3`.`t1` TO 'grantee'@'%' WITH GRANT OPTION
31GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `db3`.`p1` TO 'grantee'@'%' WITH GRANT OPTION
32GRANT EXECUTE, ALTER ROUTINE ON FUNCTION `db3`.`f1` TO 'grantee'@'%' WITH GRANT OPTION
33USE db2;
34CREATE TABLE t1(f1 int);
35USE db3;
36SELECT a FROM t2;
37a
381
392
40INSERT INTO t1 (b) VALUES (1), (2);
41SELECT f1();
42f1()
431
44CALL p1();
451
461
47DROP DATABASE db2;
48DROP DATABASE db3;
49DROP USER grantee@localhost;
50DROP USER grantee;
051
=== modified file 'mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result'
--- mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result 2014-12-01 07:53:48 +0000
+++ mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result 2015-02-09 13:07:26 +0000
@@ -209,6 +209,8 @@
209SHOW GRANTS;209SHOW GRANTS;
210Grants for @localhost210Grants for @localhost
211GRANT PROCESS ON *.* TO ''@'localhost'211GRANT PROCESS ON *.* TO ''@'localhost'
212GRANT 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 ''@'%'
213GRANT 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 ''@'%'
212SHOW processlist;214SHOW processlist;
213Id User Host db Command Time State Info Rows_sent Rows_examined215Id User Host db Command Time State Info Rows_sent Rows_examined
214ID HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS 0216ID HOST_NAME information_schema Query TIME init SHOW processlist TIME_MS 0
@@ -257,6 +259,8 @@
257SHOW GRANTS FOR ''@'localhost';259SHOW GRANTS FOR ''@'localhost';
258Grants for @localhost260Grants for @localhost
259GRANT USAGE ON *.* TO ''@'localhost'261GRANT USAGE ON *.* TO ''@'localhost'
262GRANT 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 ''@'%'
263GRANT 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 ''@'%'
260SELECT * FROM information_schema.processlist;264SELECT * FROM information_schema.processlist;
261ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED265ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED
262ID HOST_NAME information_schema Query TIME executing SELECT * FROM information_schema.processlist TIME_MS 0 0266ID HOST_NAME information_schema Query TIME executing SELECT * FROM information_schema.processlist TIME_MS 0 0
263267
=== 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:07:26 +0000
@@ -0,0 +1,53 @@
1# The bug #1354988 test.
2
3CREATE USER grantee@localhost IDENTIFIED BY 'grantee1';
4CREATE USER grantee IDENTIFIED BY 'grantee2';
5
6CREATE DATABASE db2;
7
8
9CREATE DATABASE db3;
10USE db3;
11
12CREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL DEFAULT 0);
13CREATE TABLE t2 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL DEFAULT 0);
14INSERT INTO t2 (b) VALUES (1), (2);
15
16-- delimiter |
17
18CREATE FUNCTION f1() RETURNS INT
19BEGIN
20 RETURN 1;
21END |
22
23CREATE PROCEDURE p1()
24BEGIN
25 SELECT 1;
26END |
27
28-- delimiter ;
29
30GRANT ALL PRIVILEGES ON db2.* TO grantee WITH GRANT OPTION;
31GRANT SELECT(a) ON TABLE db3.t2 TO grantee WITH GRANT OPTION;
32GRANT ALL PRIVILEGES ON TABLE db3.t1 TO grantee WITH GRANT OPTION;
33GRANT ALL PRIVILEGES ON FUNCTION db3.f1 TO grantee WITH GRANT OPTION;
34GRANT ALL PRIVILEGES ON PROCEDURE db3.p1 TO grantee WITH GRANT OPTION;
35
36-- connect (con1, localhost, grantee,grantee1,)
37-- connection con1
38SELECT user(), current_user();
39SHOW GRANTS;
40USE db2;
41CREATE TABLE t1(f1 int);
42USE db3;
43SELECT a FROM t2;
44INSERT INTO t1 (b) VALUES (1), (2);
45SELECT f1();
46CALL p1();
47-- disconnect con1
48
49-- connection default
50DROP DATABASE db2;
51DROP DATABASE db3;
52DROP USER grantee@localhost;
53DROP USER grantee;
054
=== modified file 'sql/sql_acl.cc'
--- sql/sql_acl.cc 2014-12-01 07:53:48 +0000
+++ sql/sql_acl.cc 2015-02-09 13:07:26 +0000
@@ -6940,7 +6940,7 @@
6940 */6940 */
69416941
6942 if (!strcmp(lex_user->user.str,user) &&6942 if (!strcmp(lex_user->user.str,user) &&
6943 !my_strcasecmp(system_charset_info, lex_user->host.str, host))6943 acl_db->host.compare_hostname(lex_user->host.str, lex_user->host.str))
6944 {6944 {
6945 want_access=acl_db->access;6945 want_access=acl_db->access;
6946 if (want_access)6946 if (want_access)
@@ -7010,7 +7010,8 @@
7010 */7010 */
70117011
7012 if (!strcmp(lex_user->user.str,user) &&7012 if (!strcmp(lex_user->user.str,user) &&
7013 !my_strcasecmp(system_charset_info, lex_user->host.str, host))7013 grant_table->host.compare_hostname(lex_user->host.str,
7014 lex_user->host.str))
7014 {7015 {
7015 ulong table_access= grant_table->privs;7016 ulong table_access= grant_table->privs;
7016 if ((table_access | grant_table->cols) != 0)7017 if ((table_access | grant_table->cols) != 0)
@@ -7159,7 +7160,8 @@
7159 */7160 */
71607161
7161 if (!strcmp(lex_user->user.str,user) &&7162 if (!strcmp(lex_user->user.str,user) &&
7162 !my_strcasecmp(system_charset_info, lex_user->host.str, host))7163 grant_proc->host.compare_hostname(lex_user->host.str,
7164 lex_user->host.str))
7163 {7165 {
7164 ulong proc_access= grant_proc->privs;7166 ulong proc_access= grant_proc->privs;
7165 if (proc_access != 0)7167 if (proc_access != 0)

Subscribers

People subscribed via source and target branches