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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
8dc1e334
Commit
8dc1e334
authored
Dec 16, 2010
by
Kristofer Pettersson
Browse files
Options
Browse Files
Download
Plain Diff
merge 5.1-security => 5.5-security
parents
4fd5cff8
bef12c6e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
42 deletions
+81
-42
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+10
-0
mysql-test/suite/sys_vars/r/secure_file_priv2.result
mysql-test/suite/sys_vars/r/secure_file_priv2.result
+6
-0
mysql-test/suite/sys_vars/t/secure_file_priv2-master.opt
mysql-test/suite/sys_vars/t/secure_file_priv2-master.opt
+1
-0
mysql-test/suite/sys_vars/t/secure_file_priv2.test
mysql-test/suite/sys_vars/t/secure_file_priv2.test
+23
-0
sql/sql_load.cc
sql/sql_load.cc
+41
-42
No files found.
mysql-test/mysql-test-run.pl
View file @
8dc1e334
...
@@ -2186,6 +2186,16 @@ sub environment_setup {
...
@@ -2186,6 +2186,16 @@ sub environment_setup {
$ENV
{'
MYSQL_LIBDIR
'}
=
"
$basedir
/lib
";
$ENV
{'
MYSQL_LIBDIR
'}
=
"
$basedir
/lib
";
$ENV
{'
MYSQL_SHAREDIR
'}
=
$path_language
;
$ENV
{'
MYSQL_SHAREDIR
'}
=
$path_language
;
$ENV
{'
MYSQL_CHARSETSDIR
'}
=
$path_charsetsdir
;
$ENV
{'
MYSQL_CHARSETSDIR
'}
=
$path_charsetsdir
;
if
(
IS_WINDOWS
)
{
$ENV
{'
SECURE_LOAD_PATH
'}
=
$glob_mysql_test_dir
.
"
\\
std_data
";
}
else
{
$ENV
{'
SECURE_LOAD_PATH
'}
=
$glob_mysql_test_dir
.
"
/std_data
";
}
# ----------------------------------------------------
# ----------------------------------------------------
# Setup env for NDB
# Setup env for NDB
...
...
mysql-test/suite/sys_vars/r/secure_file_priv2.result
0 → 100644
View file @
8dc1e334
CREATE TABLE t1 (c1 INT);
LOAD DATA INFILE "t1.MYI" into table t1;
ERROR HY000: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
LOAD DATA INFILE "/test" into table t1;
ERROR HY000: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
DROP TABLE t1;
mysql-test/suite/sys_vars/t/secure_file_priv2-master.opt
0 → 100644
View file @
8dc1e334
--secure_file_priv=$SECURE_LOAD_PATH
mysql-test/suite/sys_vars/t/secure_file_priv2.test
0 → 100644
View file @
8dc1e334
#
# Bug58747 breaks secure_file_priv+not secure yet+still accesses other folders
#
CREATE
TABLE
t1
(
c1
INT
);
#
# Before the patch this statement failed with
# Linux:
# -> errno 13: 'Can't get stat of '
# Windows:
# -> Warning 1366 Incorrect integer value: '■■☺' for
# -> column 'c1' at row 1
# Now it should consistently fail with ER_OPTION_PREVENTS_STATEMENT
# on all platforms.
--
error
ER_OPTION_PREVENTS_STATEMENT
LOAD
DATA
INFILE
"t1.MYI"
into
table
t1
;
#
# The following test makes the assuption that /test isn't a valid path in any
# operating system running the test suite.
--
error
ER_OPTION_PREVENTS_STATEMENT
LOAD
DATA
INFILE
"/test"
into
table
t1
;
DROP
TABLE
t1
;
sql/sql_load.cc
View file @
8dc1e334
...
@@ -363,58 +363,57 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -363,58 +363,57 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
(
void
)
fn_format
(
name
,
ex
->
file_name
,
mysql_real_data_home
,
""
,
(
void
)
fn_format
(
name
,
ex
->
file_name
,
mysql_real_data_home
,
""
,
MY_RELATIVE_PATH
|
MY_UNPACK_FILENAME
|
MY_RELATIVE_PATH
|
MY_UNPACK_FILENAME
|
MY_RETURN_REAL_PATH
);
MY_RETURN_REAL_PATH
);
#if !defined(__WIN__)
}
MY_STAT
stat_info
;
if
(
!
mysql_file_stat
(
key_file_load
,
name
,
&
stat_info
,
MYF
(
MY_WME
)))
DBUG_RETURN
(
TRUE
);
// if we are not in slave thread, the file must be:
if
(
!
thd
->
slave_thread
&&
!
((
stat_info
.
st_mode
&
S_IROTH
)
==
S_IROTH
&&
// readable by others
(
stat_info
.
st_mode
&
S_IFLNK
)
!=
S_IFLNK
&&
// and not a symlink
((
stat_info
.
st_mode
&
S_IFREG
)
==
S_IFREG
||
(
stat_info
.
st_mode
&
S_IFIFO
)
==
S_IFIFO
)))
{
my_error
(
ER_TEXTFILE_NOT_READABLE
,
MYF
(
0
),
name
);
DBUG_RETURN
(
TRUE
);
}
if
((
stat_info
.
st_mode
&
S_IFIFO
)
==
S_IFIFO
)
is_fifo
=
1
;
#endif
if
(
thd
->
slave_thread
)
if
(
thd
->
slave_thread
)
{
{
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
if
(
strncmp
(
active_mi
->
rli
.
slave_patternload_file
,
name
,
if
(
strncmp
(
active_mi
->
rli
.
slave_patternload_file
,
name
,
active_mi
->
rli
.
slave_patternload_file_size
))
active_mi
->
rli
.
slave_patternload_file_size
))
{
{
/*
LOAD DATA INFILE in the slave SQL Thread can only read from
--slave-load-tmpdir". This should never happen. Please, report a bug.
*/
sql_print_error
(
"LOAD DATA INFILE in the slave SQL Thread can only read from --slave-load-tmpdir. "
\
"Please, report a bug."
);
my_error
(
ER_OPTION_PREVENTS_STATEMENT
,
MYF
(
0
),
"--slave-load-tmpdir"
);
DBUG_RETURN
(
TRUE
);
}
#else
/*
/*
This is impossible and should never happen.
LOAD DATA INFILE in the slave SQL Thread can only read from
--slave-load-tmpdir". This should never happen. Please, report a bug.
*/
*/
DBUG_ASSERT
(
FALSE
);
#endif
sql_print_error
(
"LOAD DATA INFILE in the slave SQL Thread can only read from --slave-load-tmpdir. "
\
}
"Please, report a bug."
);
else
if
(
!
is_secure_file_path
(
name
))
my_error
(
ER_OPTION_PREVENTS_STATEMENT
,
MYF
(
0
),
"--slave-load-tmpdir"
);
{
/* Read only allowed from within dir specified by secure_file_priv */
my_error
(
ER_OPTION_PREVENTS_STATEMENT
,
MYF
(
0
),
"--secure-file-priv"
);
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
}
#else
/*
This is impossible and should never happen.
*/
DBUG_ASSERT
(
FALSE
);
#endif
}
else
if
(
!
is_secure_file_path
(
name
))
{
/* Read only allowed from within dir specified by secure_file_priv */
my_error
(
ER_OPTION_PREVENTS_STATEMENT
,
MYF
(
0
),
"--secure-file-priv"
);
DBUG_RETURN
(
TRUE
);
}
#if !defined(__WIN__) && ! defined(__NETWARE__)
MY_STAT
stat_info
;
if
(
!
my_stat
(
name
,
&
stat_info
,
MYF
(
MY_WME
)))
DBUG_RETURN
(
TRUE
);
// if we are not in slave thread, the file must be:
if
(
!
thd
->
slave_thread
&&
!
((
stat_info
.
st_mode
&
S_IROTH
)
==
S_IROTH
&&
// readable by others
(
stat_info
.
st_mode
&
S_IFLNK
)
!=
S_IFLNK
&&
// and not a symlink
((
stat_info
.
st_mode
&
S_IFREG
)
==
S_IFREG
||
(
stat_info
.
st_mode
&
S_IFIFO
)
==
S_IFIFO
)))
{
my_error
(
ER_TEXTFILE_NOT_READABLE
,
MYF
(
0
),
name
);
DBUG_RETURN
(
TRUE
);
}
}
if
((
file
=
mysql_file_open
(
key_file_load
,
if
((
file
=
mysql_file_open
(
key_file_load
,
name
,
O_RDONLY
,
MYF
(
MY_WME
)))
<
0
)
name
,
O_RDONLY
,
MYF
(
MY_WME
)))
<
0
)
#endif
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
}
...
...
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