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
209c69f8
Commit
209c69f8
authored
Nov 14, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/svoj/devel/bk/mysql-4.1-engines
into mysql.com:/home/svoj/devel/mysql/BUG31277/mysql-4.1-engines
parents
4451eec2
9f9ff461
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
mysql-test/r/symlink.result
mysql-test/r/symlink.result
+6
-0
mysql-test/t/symlink.test
mysql-test/t/symlink.test
+12
-0
mysys/my_symlink2.c
mysys/my_symlink2.c
+10
-1
No files found.
mysql-test/r/symlink.result
View file @
209c69f8
...
...
@@ -90,6 +90,12 @@ t1 CREATE TABLE `t1` (
`b` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1(a INT)
DATA DIRECTORY='TEST_DIR/master-data/mysql'
INDEX DIRECTORY='TEST_DIR/master-data/mysql';
RENAME TABLE t1 TO user;
ERROR HY000: Can't create/write to file 'TEST_DIR/master-data/mysql/user.MYI' (Errcode: 17)
DROP TABLE t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
mysql-test/t/symlink.test
View file @
209c69f8
...
...
@@ -118,6 +118,18 @@ enable_query_log;
show
create
table
t1
;
drop
table
t1
;
#
# BUG#32111 - Security Breach via DATA/INDEX DIRECORY and RENAME TABLE
#
--
replace_result
$MYSQLTEST_VARDIR
TEST_DIR
eval
CREATE
TABLE
t1
(
a
INT
)
DATA
DIRECTORY
=
'$MYSQLTEST_VARDIR/master-data/mysql'
INDEX
DIRECTORY
=
'$MYSQLTEST_VARDIR/master-data/mysql'
;
--
replace_result
$MYSQLTEST_VARDIR
TEST_DIR
--
error
1
RENAME
TABLE
t1
TO
user
;
DROP
TABLE
t1
;
#
# Test specifying DATA DIRECTORY that is the same as what would normally
# have been chosen. (Bug #8707)
...
...
mysys/my_symlink2.c
View file @
209c69f8
...
...
@@ -125,6 +125,7 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags)
int
was_symlink
=
(
!
my_disable_symlinks
&&
!
my_readlink
(
link_name
,
from
,
MYF
(
0
)));
int
result
=
0
;
int
name_is_different
;
DBUG_ENTER
(
"my_rename_with_symlink"
);
if
(
!
was_symlink
)
...
...
@@ -133,6 +134,14 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags)
/* Change filename that symlink pointed to */
strmov
(
tmp_name
,
to
);
fn_same
(
tmp_name
,
link_name
,
1
);
/* Copy dir */
name_is_different
=
strcmp
(
link_name
,
tmp_name
);
if
(
name_is_different
&&
!
access
(
tmp_name
,
F_OK
))
{
my_errno
=
EEXIST
;
if
(
MyFlags
&
MY_WME
)
my_error
(
EE_CANTCREATEFILE
,
MYF
(
0
),
tmp_name
,
EEXIST
);
DBUG_RETURN
(
1
);
}
/* Create new symlink */
if
(
my_symlink
(
tmp_name
,
to
,
MyFlags
))
...
...
@@ -144,7 +153,7 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags)
the same basename and different directories.
*/
if
(
strcmp
(
link_name
,
tmp_name
)
&&
my_rename
(
link_name
,
tmp_name
,
MyFlags
))
if
(
name_is_different
&&
my_rename
(
link_name
,
tmp_name
,
MyFlags
))
{
int
save_errno
=
my_errno
;
my_delete
(
to
,
MyFlags
);
/* Remove created symlink */
...
...
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