Skip to content

Commit 411c44f

Browse files
author
Robert Golebiowski
committed
Bug #21762656 AFTER RUNNING MYSQL_UPGRADE PROXIES_PRIV USER COLUMNS ARE NOT UPDATED TO 32
1 parent 401bf79 commit 411c44f

File tree

7 files changed

+64
-4
lines changed

7 files changed

+64
-4
lines changed

mysql-test/r/grant.result

+14
Original file line numberDiff line numberDiff line change
@@ -3009,3 +3009,17 @@ DROP USER user_name_len_32_012345678901234@localhost;
30093009
DROP USER user_name_len_25_01234567@localhost;
30103010
DROP TABLE t1;
30113011
DROP PROCEDURE p1;
3012+
CREATE USER user_name_len_22_01234@localhost;
3013+
GRANT ALL PRIVILEGES ON *.* TO user_name_len_22_01234@localhost WITH GRANT OPTION;
3014+
GRANT PROXY ON ''@'' TO user_name_len_22_01234@localhost WITH GRANT OPTION;
3015+
CREATE USER user_name_len_32_012345678901234@localhost;
3016+
GRANT SELECT ON *.* TO user_name_len_32_012345678901234@localhost;
3017+
** Creating new proxy user **
3018+
CREATE USER proxy_native_0123456789@localhost IDENTIFIED WITH mysql_native_password;
3019+
GRANT PROXY ON user_name_len_32_012345678901234@localhost TO proxy_native_0123456789@localhost;
3020+
SELECT USER, PROXIED_USER, GRANTOR FROM mysql.proxies_priv WHERE Proxied_host='localhost';
3021+
USER PROXIED_USER GRANTOR
3022+
proxy_native_0123456789 user_name_len_32_012345678901234 user_name_len_22_01234@localhost
3023+
DROP USER user_name_len_22_01234@localhost;
3024+
DROP USER user_name_len_32_012345678901234@localhost;
3025+
DROP USER proxy_native_0123456789@localhost;

mysql-test/r/mysql_upgrade.result

+7
Original file line numberDiff line numberDiff line change
@@ -2301,6 +2301,13 @@ SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
23012301
PREPARE stmt FROM @str;
23022302
EXECUTE stmt;
23032303
DROP PREPARE stmt;
2304+
#
2305+
# Bug #21762656 AFTER RUNNING MYSQL_UPGRADE PROXIES_PRIV USER COLUMNS
2306+
# ARE NOT UPDATED TO 32
2307+
#
2308+
ALTER TABLE mysql.proxies_priv MODIFY User char(16) binary DEFAULT '' NOT NULL;
2309+
ALTER TABLE mysql.proxies_priv MODIFY Proxied_user char(16) binary DEFAULT '' NOT NULL;
2310+
ALTER TABLE mysql.proxies_priv MODIFY Grantor char(77) DEFAULT '' NOT NULL;
23042311
# Tables with user name column downgraded to 5.6, now run mysql_upgrade
23052312
mysql.columns_priv OK
23062313
mysql.db OK

mysql-test/suite/funcs_1/r/is_columns_mysql.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_gen
145145
def mysql procs_priv Routine_type 5 NULL NO enum 9 27 NULL NULL NULL utf8 utf8_bin enum('FUNCTION','PROCEDURE') PRI select,insert,update,references
146146
def mysql procs_priv Timestamp 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
147147
def mysql procs_priv User 3 NO char 32 96 NULL NULL NULL utf8 utf8_bin char(32) PRI select,insert,update,references
148-
def mysql proxies_priv Grantor 6 NO char 77 231 NULL NULL NULL utf8 utf8_bin char(77) MUL select,insert,update,references
148+
def mysql proxies_priv Grantor 6 NO char 93 279 NULL NULL NULL utf8 utf8_bin char(77) MUL select,insert,update,references
149149
def mysql proxies_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
150150
def mysql proxies_priv Proxied_host 3 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
151151
def mysql proxies_priv Proxied_user 4 NO char 32 96 NULL NULL NULL utf8 utf8_bin char(32) PRI select,insert,update,references

mysql-test/t/grant.test

+24
Original file line numberDiff line numberDiff line change
@@ -2716,5 +2716,29 @@ DROP USER user_name_len_25_01234567@localhost;
27162716

27172717
DROP TABLE t1;
27182718
DROP PROCEDURE p1;
2719+
2720+
#
2721+
# Bug#21762656 AFTER RUNNING MYSQL_UPGRADE PROXIES_PRIV USER COLUMNS ARE NOT UPDATED TO 32
2722+
#
2723+
2724+
CREATE USER user_name_len_22_01234@localhost;
2725+
GRANT ALL PRIVILEGES ON *.* TO user_name_len_22_01234@localhost WITH GRANT OPTION;
2726+
GRANT PROXY ON ''@'' TO user_name_len_22_01234@localhost WITH GRANT OPTION;
2727+
CONNECT (conn_su,localhost,user_name_len_22_01234,,);
2728+
2729+
CREATE USER user_name_len_32_012345678901234@localhost;
2730+
GRANT SELECT ON *.* TO user_name_len_32_012345678901234@localhost;
2731+
--echo ** Creating new proxy user **
2732+
CREATE USER proxy_native_0123456789@localhost IDENTIFIED WITH mysql_native_password;
2733+
GRANT PROXY ON user_name_len_32_012345678901234@localhost TO proxy_native_0123456789@localhost;
2734+
SELECT USER, PROXIED_USER, GRANTOR FROM mysql.proxies_priv WHERE Proxied_host='localhost';
2735+
2736+
connection default;
2737+
disconnect conn_su;
2738+
DROP USER user_name_len_22_01234@localhost;
2739+
DROP USER user_name_len_32_012345678901234@localhost;
2740+
DROP USER proxy_native_0123456789@localhost;
2741+
2742+
27192743
# Wait till we reached the initial number of concurrent sessions
27202744
--source include/wait_until_count_sessions.inc

mysql-test/t/mysql_upgrade.test

+9
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,15 @@ PREPARE stmt FROM @str;
10921092
EXECUTE stmt;
10931093
DROP PREPARE stmt;
10941094

1095+
--echo #
1096+
--echo # Bug #21762656 AFTER RUNNING MYSQL_UPGRADE PROXIES_PRIV USER COLUMNS
1097+
--echo # ARE NOT UPDATED TO 32
1098+
--echo #
1099+
1100+
ALTER TABLE mysql.proxies_priv MODIFY User char(16) binary DEFAULT '' NOT NULL;
1101+
ALTER TABLE mysql.proxies_priv MODIFY Proxied_user char(16) binary DEFAULT '' NOT NULL;
1102+
ALTER TABLE mysql.proxies_priv MODIFY Grantor char(77) DEFAULT '' NOT NULL;
1103+
10951104
--echo # Tables with user name column downgraded to 5.6, now run mysql_upgrade
10961105

10971106
--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1

scripts/mysql_system_tables.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
1+
-- Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
22
--
33
-- This program is free software; you can redistribute it and/or modify
44
-- it under the terms of the GNU General Public License as published by
@@ -2567,7 +2567,7 @@ PREPARE stmt FROM @str;
25672567
EXECUTE stmt;
25682568
DROP PREPARE stmt;
25692569

2570-
CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(32) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(32) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';
2570+
CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(32) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(32) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(93) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';
25712571

25722572
-- Remember for later if proxies_priv table already existed
25732573
set @had_proxies_priv_table= @@warning_count != 0;

scripts/mysql_system_tables_fix.sql

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
1+
-- Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
22
--
33
-- This program is free software; you can redistribute it and/or modify
44
-- it under the terms of the GNU General Public License as published by
@@ -196,6 +196,12 @@ ADD max_questions int(11) NOT NULL DEFAULT 0 AFTER x509_subject,
196196
ADD max_updates int(11) unsigned NOT NULL DEFAULT 0 AFTER max_questions,
197197
ADD max_connections int(11) unsigned NOT NULL DEFAULT 0 AFTER max_updates;
198198

199+
#
200+
# Update proxies_priv definition.
201+
#
202+
ALTER TABLE proxies_priv MODIFY User char(32) binary DEFAULT '' NOT NULL;
203+
ALTER TABLE proxies_priv MODIFY Proxied_user char(32) binary DEFAULT '' NOT NULL;
204+
ALTER TABLE proxies_priv MODIFY Grantor char(93) DEFAULT '' NOT NULL;
199205

200206
#
201207
# Add Create_tmp_table_priv and Lock_tables_priv to db

0 commit comments

Comments
 (0)