#At file:///home/svoj/devel/bzr-mysql/mysql-6.0-falcon-team-bug32398/
2918 Sergey Vojtovich 2008-11-19
BUG#32398 - Falcon: tablespace file can be table file
This is second attempt to fix this bug. Sometime after
first fix logic of test_if_data_home_dir() has changed,
thus the fix was reverted.
Falcon allows to create tablespace data files inside data base. That
means users could corrupt data in tables or crash a server.
Fixed by rejecting tablespace data file names, pointing to
data_home/database_name directory.
modified:
mysql-test/suite/falcon/t/disabled.def
storage/falcon/ha_falcon.cpp
per-file messages:
mysql-test/suite/falcon/t/disabled.def
Re-enabled falcon_bug_32398 test.
storage/falcon/ha_falcon.cpp
Refuse to create tablespace data files in mysql database
directories.
Since the logic of test_if_data_home_dir() has changed
(it doesn't allow to create files in mysql data directory),
we cannot use it anymore.
=== modified file 'mysql-test/suite/falcon/t/disabled.def'
--- a/mysql-test/suite/falcon/t/disabled.def 2008-11-04 15:22:06 +0000
+++ b/mysql-test/suite/falcon/t/disabled.def 2008-11-19 09:32:54 +0000
@@ -10,4 +10,3 @@
#
##############################################################################
-falcon_bug_32398 : HF disabled until new fix for this bug is developed
=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp 2008-11-16 11:30:45 +0000
+++ b/storage/falcon/ha_falcon.cpp 2008-11-19 09:32:54 +0000
@@ -2120,23 +2120,34 @@ int StorageInterface::alter_tablespace(h
for NDB only.
*/
- /*
- Sergey Vojtovich is to reconsider this code
if (ts_info->data_file_name)
{
char buff[FN_REFLEN];
size_t dirname_part_length;
+ /*
+ Refuse to create a data file in mysql database directory. It is still
+ allowed to create one in mysql data directory.
+
+ This is implemented as following:
+ - take directory part of the path
+ - canonicalize path using fn_format()
+ - compare path against canonicalized mysql data directory
+ - only compare if path is longer than mysql data directory
+ - if lower_case_file_system is set use my_strnncoll()
+ - else use memcmp()
+ */
dirname_part(buff, ts_info->data_file_name, &dirname_part_length);
fn_format(buff, buff, mysql_real_data_home, "",
- MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
- if (test_if_data_home_dir(buff))
+ MY_RELATIVE_PATH | MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH);
+ if (mysql_unpacked_real_data_home_len < (int) strlen(buff) &&
+ (lower_case_file_system ? !my_strnncoll(default_charset_info, (const uchar *) buff,
mysql_unpacked_real_data_home_len, (const uchar *) mysql_unpacked_real_data_home,
mysql_unpacked_real_data_home_len)
+ : !memcmp(buff, mysql_unpacked_real_data_home, mysql_unpacked_real_data_home_len)))
{
my_error(ER_WRONG_ARGUMENTS, MYF(0), "DATAFILE");
DBUG_RETURN(1);
}
}
- */
switch (ts_info->ts_cmd_type)
{
| Thread |
|---|
| • bzr commit into mysql-6.0-falcon-team branch (svoj:2918) Bug#32398 | Sergey Vojtovich | 19 Nov |