List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:April 10 2008 1:28pm
Subject:bk commit into 6.0 tree (svoj:1.2634) BUG#32398
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of svoj.  When svoj does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-04-10 16:28:11+05:00, svoj@stripped +3 -0
  BUG#32398 - Falcon: tablespace file can be table file
  
  Falcon allows to create tablespace data files inside data base. That
  means users could corrupt data in tables or crash a server.
  
  This bug is similiar to BUG32167.
  
  Fixed by rejecting tablespace data file names, pointing to
  data_home/database_name directory.
  
  Note that a check for data file name correctness seem to be engine
  specific. At least it looks like NDB data files are created by
  different process, which may run on a different host. That means
  rules that are good for falcon wouldn't work with NDB.

  mysql-test/suite/falcon/r/falcon_bug_32398.result@stripped, 2008-04-10 16:28:08+05:00,
svoj@stripped +7 -0
    A test case for BUG#32398.

  mysql-test/suite/falcon/r/falcon_bug_32398.result@stripped, 2008-04-10 16:28:08+05:00,
svoj@stripped +0 -0

  mysql-test/suite/falcon/t/falcon_bug_32398.test@stripped, 2008-04-10 16:28:08+05:00,
svoj@stripped +14 -0
    A test case for BUG#32398.

  mysql-test/suite/falcon/t/falcon_bug_32398.test@stripped, 2008-04-10 16:28:08+05:00,
svoj@stripped +0 -0

  storage/falcon/ha_falcon.cpp@stripped, 2008-04-10 16:28:08+05:00, svoj@stripped +13 -0
    Do not allow to create/drop tablespace data file which is inside the
    database directory.

diff -Nrup a/mysql-test/suite/falcon/r/falcon_bug_32398.result
b/mysql-test/suite/falcon/r/falcon_bug_32398.result
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/suite/falcon/r/falcon_bug_32398.result	2008-04-10 16:28:08 +05:00
@@ -0,0 +1,7 @@
+CREATE TABLESPACE ts1 ADD DATAFILE 'test/ts1.fts' ENGINE=falcon;
+ERROR HY000: Incorrect arguments to DATAFILE
+CREATE TABLESPACE ts1 ADD DATAFILE 'TEST_DIR/master-data/test/ts1.fts'
+ENGINE=falcon;
+ERROR HY000: Incorrect arguments to DATAFILE
+CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=falcon;
+DROP TABLESPACE ts1 ENGINE=falcon;
diff -Nrup a/mysql-test/suite/falcon/t/falcon_bug_32398.test
b/mysql-test/suite/falcon/t/falcon_bug_32398.test
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/suite/falcon/t/falcon_bug_32398.test	2008-04-10 16:28:08 +05:00
@@ -0,0 +1,14 @@
+--source include/have_falcon.inc
+
+#
+# BUG#32398 - Falcon: tablespace file can be table file
+#
+#CREATE TABLE t1(a INT) DATA DIRECTORY='mysql';
+--error ER_WRONG_ARGUMENTS
+CREATE TABLESPACE ts1 ADD DATAFILE 'test/ts1.fts' ENGINE=falcon;
+--replace_result $MYSQLTEST_VARDIR TEST_DIR
+--error ER_WRONG_ARGUMENTS
+eval CREATE TABLESPACE ts1 ADD DATAFILE '$MYSQLTEST_VARDIR/master-data/test/ts1.fts'
+ENGINE=falcon;
+CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=falcon;
+DROP TABLESPACE ts1 ENGINE=falcon;
diff -Nrup a/storage/falcon/ha_falcon.cpp b/storage/falcon/ha_falcon.cpp
--- a/storage/falcon/ha_falcon.cpp	2008-04-09 15:02:56 +05:00
+++ b/storage/falcon/ha_falcon.cpp	2008-04-10 16:28:08 +05:00
@@ -2026,6 +2026,19 @@ int StorageInterface::alter_tablespace(h
 		[COMMENT [=] comment_text]
 		ENGINE [=] engine
 	*/
+	if (ts_info->data_file_name)
+		{
+		char buff[FN_REFLEN];
+		size_t dirname_part_length;
+		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_error(ER_WRONG_ARGUMENTS, MYF(0), "DATAFILE");
+			DBUG_RETURN(1);
+			}
+		}
 
 	switch (ts_info->ts_cmd_type)
 		{
Thread
bk commit into 6.0 tree (svoj:1.2634) BUG#32398Sergey Vojtovich10 Apr 2008