Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
761b355d
Commit
761b355d
authored
Apr 21, 2008
by
msvensson@pilot.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add check for unix socket path truncation
Don't allow unix socket path to be truncated
parent
206e1dc6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
12 deletions
+49
-12
mysql-test/lib/My/Platform.pm
mysql-test/lib/My/Platform.pm
+39
-1
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+10
-11
No files found.
mysql-test/lib/My/Platform.pm
View file @
761b355d
...
...
@@ -20,7 +20,8 @@ use strict;
use
base
qw(Exporter)
;
our
@EXPORT
=
qw(IS_CYGWIN IS_WINDOWS IS_WIN32PERL
native_path posix_path mixed_path)
;
native_path posix_path mixed_path
check_socket_path_length)
;
BEGIN
{
if
(
$^O
eq
"
cygwin
")
{
...
...
@@ -50,6 +51,15 @@ BEGIN {
}
}
BEGIN
{
if
(
eval
"
use IO::Socket::UNIX; 1
")
{
eval
'
sub HAVE_UNIX_SOCKET { 1 }
';
}
else
{
eval
'
sub HAVE_UNIX_SOCKET { 0 }
';
}
}
#
# native_path
...
...
@@ -91,5 +101,33 @@ sub posix_path {
}
sub
check_socket_path_length
{
my
(
$path
)
=
@_
;
my
$truncated
=
0
;
if
(
HAVE_UNIX_SOCKET
){
require
IO::Socket::
UNIX
;
my
$sock
=
new
IO::Socket::
UNIX
(
Local
=>
$path
,
Listen
=>
1
,
)
or
die
$!
;
if
(
$path
ne
$sock
->
hostpath
()){
# Path was truncated
$truncated
=
1
;
# Output diagnostic messages
print
"
path: '
$path
', length:
",
length
(
$path
)
,"
\n
";
print
"
hostpath: '
",
$sock
->
hostpath
(),
"
', length:
",
length
(
$sock
->
hostpath
()),
"
\n
";
}
$sock
=
undef
;
unlink
(
$path
);
return
$truncated
;
};
# All paths OK!
return
$truncated
;
}
1
;
mysql-test/mysql-test-run.pl
View file @
761b355d
...
...
@@ -606,6 +606,15 @@ sub command_line_setup {
$opt_tmpdir
=
"
$opt_vardir
/tmp
"
unless
$opt_tmpdir
;
$opt_tmpdir
=~
s,/+$,,
;
# Remove ending slash if any
# On some operating systems, there is a limit to the length of a
# UNIX domain socket's path far below PATH_MAX.
# Don't allow that to happen
if
(
check_socket_path_length
("
$opt_tmpdir
/testsocket.sock
")){
mtr_error
("
Socket path '
$opt_tmpdir
' too long, it would be
",
"
truncated and thus not possible to use for connection to
",
"
MySQL Server. Set a shorter with --tmpdir=<path> option
");
}
# --------------------------------------------------------------------------
# fast option
# --------------------------------------------------------------------------
...
...
@@ -735,17 +744,6 @@ sub command_line_setup {
$opt_user
=
"
root
";
# We want to do FLUSH xxx commands
}
# On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
# considered different, so avoid the extra slash (/) in the socket
# paths.
my
$sockdir
=
$opt_tmpdir
;
$sockdir
=~
s|/+$||
;
# On some operating systems, there is a limit to the length of a
# UNIX domain socket's path far below PATH_MAX, so try to avoid long
# socket path names.
$sockdir
=
tempdir
(
CLEANUP
=>
0
)
if
(
length
(
$sockdir
)
>=
70
);
$path_testlog
=
"
$opt_vardir
/log/mysqltest.log
";
$path_current_testlog
=
"
$opt_vardir
/log/current_test
";
...
...
@@ -1186,6 +1184,7 @@ sub environment_setup {
$ENV
{'
MYSQL_TEST_DIR
'}
=
$glob_mysql_test_dir
;
$ENV
{'
MYSQLTEST_VARDIR
'}
=
$opt_vardir
;
$ENV
{'
DEFAULT_MASTER_PORT
'}
=
$mysqld_variables
{'
master-port
'}
||
3306
;
$ENV
{'
MYSQL_TMP_DIR
'}
=
$opt_tmpdir
;
# ----------------------------------------------------
# Setup env for NDB
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment