Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 201669 | Differences between
and this patch

Collapse All | Expand All

(-)mysql/mysql-test/r/symlink.result (+6 lines)
Lines 99-104 t1 CREATE TABLE `t1` ( Link Here
99
  `b` int(11) default NULL
99
  `b` int(11) default NULL
100
) ENGINE=MyISAM DEFAULT CHARSET=latin1
100
) ENGINE=MyISAM DEFAULT CHARSET=latin1
101
drop table t1;
101
drop table t1;
102
CREATE TABLE t1(a INT)
103
DATA DIRECTORY='TEST_DIR/master-data/mysql'
104
INDEX DIRECTORY='TEST_DIR/master-data/mysql';
105
RENAME TABLE t1 TO user;
106
ERROR HY000: Can't create/write to file 'TEST_DIR/master-data/mysql/user.MYI' (Errcode: 17)
107
DROP TABLE t1;
102
show create table t1;
108
show create table t1;
103
Table	Create Table
109
Table	Create Table
104
t1	CREATE TABLE `t1` (
110
t1	CREATE TABLE `t1` (
(-)mysql/mysql-test/t/symlink.test (+12 lines)
Lines 125-130 show create table t1; Link Here
125
drop table t1;
125
drop table t1;
126
126
127
#
127
#
128
# BUG#32111 - Security Breach via DATA/INDEX DIRECORY and RENAME TABLE
129
#
130
--replace_result $MYSQLTEST_VARDIR TEST_DIR
131
eval CREATE TABLE t1(a INT)
132
DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql'
133
INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql';
134
--replace_result $MYSQLTEST_VARDIR TEST_DIR
135
--error 1
136
RENAME TABLE t1 TO user;
137
DROP TABLE t1;
138
139
#
128
# Test specifying DATA DIRECTORY that is the same as what would normally
140
# Test specifying DATA DIRECTORY that is the same as what would normally
129
# have been chosen. (Bug #8707)
141
# have been chosen. (Bug #8707)
130
#
142
#
(-)mysql/mysys/my_symlink2.c (-1 / +10 lines)
Lines 124-129 int my_rename_with_symlink(const char *f Link Here
124
  int was_symlink= (!my_disable_symlinks &&
124
  int was_symlink= (!my_disable_symlinks &&
125
		    !my_readlink(link_name, from, MYF(0)));
125
		    !my_readlink(link_name, from, MYF(0)));
126
  int result=0;
126
  int result=0;
127
  int name_is_different;
127
  DBUG_ENTER("my_rename_with_symlink");
128
  DBUG_ENTER("my_rename_with_symlink");
128
129
129
  if (!was_symlink)
130
  if (!was_symlink)
Lines 132-137 int my_rename_with_symlink(const char *f Link Here
132
  /* Change filename that symlink pointed to */
133
  /* Change filename that symlink pointed to */
133
  strmov(tmp_name, to);
134
  strmov(tmp_name, to);
134
  fn_same(tmp_name,link_name,1);		/* Copy dir */
135
  fn_same(tmp_name,link_name,1);		/* Copy dir */
136
  name_is_different= strcmp(link_name, tmp_name);
137
  if (name_is_different && !access(tmp_name, F_OK))
138
  {
139
    my_errno= EEXIST;
140
    if (MyFlags & MY_WME)
141
      my_error(EE_CANTCREATEFILE, MYF(0), tmp_name, EEXIST);
142
    DBUG_RETURN(1);
143
  }
135
144
136
  /* Create new symlink */
145
  /* Create new symlink */
137
  if (my_symlink(tmp_name, to, MyFlags))
146
  if (my_symlink(tmp_name, to, MyFlags))
Lines 143-149 int my_rename_with_symlink(const char *f Link Here
143
    the same basename and different directories.
152
    the same basename and different directories.
144
   */
153
   */
145
154
146
  if (strcmp(link_name, tmp_name) && my_rename(link_name, tmp_name, MyFlags))
155
  if (name_is_different && my_rename(link_name, tmp_name, MyFlags))
147
  {
156
  {
148
    int save_errno=my_errno;
157
    int save_errno=my_errno;
149
    my_delete(to, MyFlags);			/* Remove created symlink */
158
    my_delete(to, MyFlags);			/* Remove created symlink */

Return to bug 201669