Skip to content

Commit 77c9917

Browse files
MDEV-34716 Fix mysql.servers socket max length too short
The limit of socket length on unix according to libc is 108, see sockaddr_un::sun_path, but in the table it is a string of max length 64, which results in truncation of socket and failure to connect by plugins using servers such as spider.
1 parent bc61218 commit 77c9917

16 files changed

+88
-14
lines changed

mysql-test/main/mysqldump-system,win.rdiff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@@ -442,7 +442,7 @@
44
mysql.time_zone_transition 3895294076
55
mysql.plugin 0
6-
mysql.servers 2783974349
6+
mysql.servers 4154392229
77
-mysql.func 3241572444
88
+mysql.func 310494789
99
mysql.innodb_table_stats 347867921
@@ -12,7 +12,7 @@
1212
@@ -477,7 +477,7 @@
1313
mysql.time_zone_transition 3895294076
1414
mysql.plugin 0
15-
mysql.servers 2783974349
15+
mysql.servers 4154392229
1616
-mysql.func 3241572444
1717
+mysql.func 310494789
1818
mysql.innodb_table_stats 347867921

mysql-test/main/mysqldump-system.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ Table Checksum
444444
mysql.roles_mapping 3150178430
445445
mysql.time_zone_transition 3895294076
446446
mysql.plugin 0
447-
mysql.servers 2783974349
447+
mysql.servers 4154392229
448448
mysql.func 3241572444
449449
mysql.innodb_table_stats 347867921
450450
mysql.table_stats 664320059
@@ -479,7 +479,7 @@ Table Checksum
479479
mysql.roles_mapping 3150178430
480480
mysql.time_zone_transition 3895294076
481481
mysql.plugin 0
482-
mysql.servers 2783974349
482+
mysql.servers 4154392229
483483
mysql.func 3241572444
484484
mysql.innodb_table_stats 347867921
485485
mysql.table_stats 664320059

mysql-test/main/servers.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ SELECT * FROM mysql.servers;
2424
Server_name Host Db Username Password Port Socket Wrapper Owner
2525
s1 3306 bar mysql
2626
DROP SERVER s1;
27+
CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET '/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock');
28+
SELECT Socket FROM mysql.servers where Server_name = 's1';
29+
Socket
30+
/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock
31+
DROP SERVER s1;
2732
#
2833
# MDEV-33783 CREATE SERVER segfaults on wrong mysql.servers
2934
#

mysql-test/main/servers.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET 'bar');
2323
SELECT * FROM mysql.servers;
2424
DROP SERVER s1;
2525

26+
CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET '/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock');
27+
SELECT Socket FROM mysql.servers where Server_name = 's1';
28+
DROP SERVER s1;
29+
2630
--echo #
2731
--echo # MDEV-33783 CREATE SERVER segfaults on wrong mysql.servers
2832
--echo #

mysql-test/main/system_mysql_db.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ servers CREATE TABLE `servers` (
129129
`Username` char(80) NOT NULL DEFAULT '',
130130
`Password` char(64) NOT NULL DEFAULT '',
131131
`Port` int(4) NOT NULL DEFAULT 0,
132-
`Socket` char(64) NOT NULL DEFAULT '',
132+
`Socket` char(108) NOT NULL DEFAULT '',
133133
`Wrapper` char(64) NOT NULL DEFAULT '',
134134
`Owner` varchar(512) NOT NULL DEFAULT '',
135135
PRIMARY KEY (`Server_name`)

mysql-test/main/system_mysql_db_fix40123.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ servers CREATE TABLE `servers` (
167167
`Username` char(80) NOT NULL DEFAULT '',
168168
`Password` char(64) NOT NULL DEFAULT '',
169169
`Port` int(4) NOT NULL DEFAULT 0,
170-
`Socket` char(64) NOT NULL DEFAULT '',
170+
`Socket` char(108) NOT NULL DEFAULT '',
171171
`Wrapper` char(64) NOT NULL DEFAULT '',
172172
`Owner` varchar(512) NOT NULL DEFAULT '',
173173
PRIMARY KEY (`Server_name`)

mysql-test/main/system_mysql_db_fix50030.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ servers CREATE TABLE `servers` (
171171
`Username` char(80) NOT NULL DEFAULT '',
172172
`Password` char(64) NOT NULL DEFAULT '',
173173
`Port` int(4) NOT NULL DEFAULT 0,
174-
`Socket` char(64) NOT NULL DEFAULT '',
174+
`Socket` char(108) NOT NULL DEFAULT '',
175175
`Wrapper` char(64) NOT NULL DEFAULT '',
176176
`Owner` varchar(512) NOT NULL DEFAULT '',
177177
PRIMARY KEY (`Server_name`)

mysql-test/main/system_mysql_db_fix50117.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ servers CREATE TABLE `servers` (
151151
`Username` char(80) NOT NULL DEFAULT '',
152152
`Password` char(64) NOT NULL DEFAULT '',
153153
`Port` int(4) NOT NULL DEFAULT 0,
154-
`Socket` char(64) NOT NULL DEFAULT '',
154+
`Socket` char(108) NOT NULL DEFAULT '',
155155
`Wrapper` char(64) NOT NULL DEFAULT '',
156156
`Owner` varchar(512) NOT NULL DEFAULT '',
157157
PRIMARY KEY (`Server_name`)

mysql-test/main/system_mysql_db_fix50568.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ servers CREATE TABLE `servers` (
172172
`Username` char(80) NOT NULL DEFAULT '',
173173
`Password` char(64) NOT NULL DEFAULT '',
174174
`Port` int(4) NOT NULL DEFAULT 0,
175-
`Socket` char(64) NOT NULL DEFAULT '',
175+
`Socket` char(108) NOT NULL DEFAULT '',
176176
`Wrapper` char(64) NOT NULL DEFAULT '',
177177
`Owner` varchar(512) NOT NULL DEFAULT '',
178178
PRIMARY KEY (`Server_name`)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def mysql servers Owner 9 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_genera
163163
def mysql servers Password 5 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references NEVER NULL
164164
def mysql servers Port 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(4) select,insert,update,references NEVER NULL
165165
def mysql servers Server_name 1 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) PRI select,insert,update,references NEVER NULL
166-
def mysql servers Socket 7 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references NEVER NULL
166+
def mysql servers Socket 7 '' NO char 108 324 NULL NULL NULL utf8 utf8_general_ci char(108) select,insert,update,references NEVER NULL
167167
def mysql servers Username 4 '' NO char 80 240 NULL NULL NULL utf8 utf8_general_ci char(80) select,insert,update,references NEVER NULL
168168
def mysql servers Wrapper 8 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references NEVER NULL
169169
def mysql slow_log db 7 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references NEVER NULL
@@ -490,7 +490,7 @@ NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp
490490
3.0000 mysql servers Username char 80 240 utf8 utf8_general_ci char(80)
491491
3.0000 mysql servers Password char 64 192 utf8 utf8_general_ci char(64)
492492
NULL mysql servers Port int NULL NULL NULL NULL int(4)
493-
3.0000 mysql servers Socket char 64 192 utf8 utf8_general_ci char(64)
493+
3.0000 mysql servers Socket char 108 324 utf8 utf8_general_ci char(108)
494494
3.0000 mysql servers Wrapper char 64 192 utf8 utf8_general_ci char(64)
495495
3.0000 mysql servers Owner varchar 512 1536 utf8 utf8_general_ci varchar(512)
496496
NULL mysql slow_log start_time timestamp NULL NULL NULL NULL timestamp(6)

0 commit comments

Comments
 (0)