Skip to content

Commit 3dbbcfc

Browse files
steaphangreenejtolmer
authored andcommitted
Increase max user name length to 80
Summary: This mitigates upstream bug: http://bugs.mysql.com/3083 User name length limit of 16 was too short, so made it 80. 80 is effectively the limit without making additional changes because of MyISAM's 1000 byte limit on key length and the primary key of mysql.columns_priv. To compute the size of the key for that table, the lengths of the char fields are summed and then multipled by 3, resulting in a limit on the max size of user name lengths being 81 characters. Test Plan: Added long user names to basic grant and replication tests. Did full build and test run without perfschema, no failures. Did full build and test run with perfschema, no new failures. Jenkins both 'arc unit', and 'arc unit --everything', pass Built a test rpm, ran it through rpm tests, passed. Installed the test rpm on a test server, then downgraded it: "use mysql; show create table user;", and got: * Before upgrade: "...`User` char(16)..." * After upgrade: "...`User` char(16)..." * After restart: "...`User` char(16)..." * After running mysql_upgrade: "...`User` char(80)..." * After downgrade: "...`User` char(80)..." * After restart: "...`User` char(80)..." * After running mysql_upgrade: "...`User` char(16)..." Reviewers: rudradevbasak, jtolmer, chip, santoshb Reviewed By: santoshb
1 parent 6a28d54 commit 3dbbcfc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+360
-349
lines changed

include/mysql.h.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@
511511
socklen_t len;
512512
unsigned long pkt_length;
513513
char *host_info;
514-
char buff[(64*3)+(16*3)+100];
514+
char buff[(64*3)+(80*3)+100];
515515
int scramble_data_len;
516516
int pkt_scramble_len;
517517
char *scramble_data;

include/mysql/plugin_auth.h.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@
288288
unsigned int user_name_length;
289289
const char *auth_string;
290290
unsigned long auth_string_length;
291-
char authenticated_as[48 +1];
291+
char authenticated_as[240 +1];
292292
char external_user[512];
293293
int password_used;
294294
const char *host_or_ip;

include/mysql/plugin_auth_common.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@
2222
*/
2323
#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED
2424

25-
/** the max allowed length for a user name */
26-
#define MYSQL_USERNAME_LENGTH 48
25+
/**
26+
The max allowed length for a user name. Equivalent to USERNAME_LENGTH
27+
which is USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN.
28+
*/
29+
30+
#define MYSQL_USERNAME_LENGTH 240
2731

2832
/**
2933
return values of the plugin authenticate_user() method.

include/mysql_com.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define HOSTNAME_LENGTH 60
2424
#define SYSTEM_CHARSET_MBMAXLEN 3
2525
#define NAME_CHAR_LEN 64 /* Field/table name length */
26-
#define USERNAME_CHAR_LENGTH 16
26+
#define USERNAME_CHAR_LENGTH 80
2727
#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
2828
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
2929

mysql-test/r/create.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,7 @@ show create table t1;
18911891
Table Create Table
18921892
t1 CREATE TABLE `t1` (
18931893
`ID` bigint(21) unsigned NOT NULL DEFAULT '0',
1894-
`USER` varchar(16) NOT NULL DEFAULT '',
1894+
`USER` varchar(80) NOT NULL DEFAULT '',
18951895
`HOST` varchar(64) NOT NULL DEFAULT '',
18961896
`DB` varchar(64) DEFAULT NULL,
18971897
`COMMAND` varchar(16) NOT NULL DEFAULT '',
@@ -1905,7 +1905,7 @@ show create table t1;
19051905
Table Create Table
19061906
t1 CREATE TEMPORARY TABLE `t1` (
19071907
`ID` bigint(21) unsigned NOT NULL DEFAULT '0',
1908-
`USER` varchar(16) NOT NULL DEFAULT '',
1908+
`USER` varchar(80) NOT NULL DEFAULT '',
19091909
`HOST` varchar(64) NOT NULL DEFAULT '',
19101910
`DB` varchar(64) DEFAULT NULL,
19111911
`COMMAND` varchar(16) NOT NULL DEFAULT '',

mysql-test/r/func_system.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ show create table t1;
4747
Table Create Table
4848
t1 CREATE TABLE `t1` (
4949
`database()` varchar(34) CHARACTER SET utf8 DEFAULT NULL,
50-
`user()` varchar(77) CHARACTER SET utf8 NOT NULL DEFAULT '',
50+
`user()` varchar(141) CHARACTER SET utf8 NOT NULL DEFAULT '',
5151
`version` char(60) DEFAULT NULL
5252
) ENGINE=MyISAM DEFAULT CHARSET=latin1
5353
drop table t1;

mysql-test/r/grant.result

Lines changed: 141 additions & 137 deletions
Large diffs are not rendered by default.

mysql-test/r/join.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ columns.TABLE_CATALOG, columns.TABLE_SCHEMA, columns.COLUMN_DEFAULT, columns.IS_
753753
from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='user';
754754
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA COLUMN_COMMENT
755755
user Host def mysql 0 mysql PRIMARY 1 A NULL NULL BTREE def mysql NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI
756-
user User def mysql 0 mysql PRIMARY 2 A NULL NULL BTREE def mysql NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI
756+
user User def mysql 0 mysql PRIMARY 2 A NULL NULL BTREE def mysql NO char 80 240 NULL NULL utf8 utf8_bin char(80) PRI
757757
drop table t1;
758758
drop table t2;
759759
drop table t3;

mysql-test/r/plugin_auth.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ SHOW CREATE TABLE mysql.proxies_priv;
2626
Table Create Table
2727
proxies_priv CREATE TABLE `proxies_priv` (
2828
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
29-
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
29+
`User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
3030
`Proxied_host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
31-
`Proxied_user` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
31+
`Proxied_user` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
3232
`With_grant` tinyint(1) NOT NULL DEFAULT '0',
3333
`Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
3434
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

mysql-test/r/sp.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5270,11 +5270,11 @@ use test|
52705270
drop table t3|
52715271
DROP PROCEDURE IF EXISTS bug16899_p1|
52725272
DROP FUNCTION IF EXISTS bug16899_f1|
5273-
CREATE DEFINER=1234567890abcdefGHIKL@localhost PROCEDURE bug16899_p1()
5273+
CREATE DEFINER=abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890a@localhost PROCEDURE bug16899_p1()
52745274
BEGIN
52755275
SET @a = 1;
52765276
END|
5277-
ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
5277+
ERROR HY000: String 'abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij' is too long for user name (should be no longer than 80)
52785278
CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY
52795279
FUNCTION bug16899_f1() RETURNS INT
52805280
BEGIN

0 commit comments

Comments
 (0)