summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <ramil/ram@mysql.com/myoffice.izhnet.ru>2006-07-14 16:26:58 +0500
committerunknown <ramil/ram@mysql.com/myoffice.izhnet.ru>2006-07-14 16:26:58 +0500
commit39f9adfa849a9763dd883fd4661eb9ddfb47d576 (patch)
tree9741bdd736d6a09ae7e8bbcab977f7ebbc1efd73
parent1787072458f518c68b940f17f54f2b5658f45469 (diff)
downloadmariadb-git-39f9adfa849a9763dd883fd4661eb9ddfb47d576.tar.gz
--{skip-}merge option added which allows the user to disable merge engine and
to avoid the potential security problem. (see bug #15195: Security Breach with MERGE table)
-rw-r--r--mysql-test/r/warnings.result7
-rw-r--r--mysql-test/t/warnings-master.opt2
-rw-r--r--mysql-test/t/warnings.test4
-rw-r--r--sql/handler.cc4
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/mysqld.cc12
-rw-r--r--sql/set_var.cc1
7 files changed, 26 insertions, 6 deletions
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index b9c05bc388c..69d33de75f4 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -171,6 +171,13 @@ alter table t1 engine=isam;
Warnings:
Warning 1266 Using storage engine MyISAM for table 't1'
drop table t1;
+create table t1 (id int) engine=merge;
+Warnings:
+Warning 1266 Using storage engine MyISAM for table 't1'
+alter table t1 engine=merge;
+Warnings:
+Warning 1266 Using storage engine MyISAM for table 't1'
+drop table t1;
create table t1 (id int) type=heap;
Warnings:
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
diff --git a/mysql-test/t/warnings-master.opt b/mysql-test/t/warnings-master.opt
index 3b8baeddb14..e924a22e2ce 100644
--- a/mysql-test/t/warnings-master.opt
+++ b/mysql-test/t/warnings-master.opt
@@ -1 +1 @@
---skip-isam
+--skip-isam --skip-merge
diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test
index 4bc8a338a35..aee03b39353 100644
--- a/mysql-test/t/warnings.test
+++ b/mysql-test/t/warnings.test
@@ -118,6 +118,10 @@ create table t1 (id int) engine=isam;
alter table t1 engine=isam;
drop table t1;
+create table t1 (id int) engine=merge;
+alter table t1 engine=merge;
+drop table t1;
+
#
# Test for deprecated TYPE= syntax
#
diff --git a/sql/handler.cc b/sql/handler.cc
index e166f9885fc..c05fc8ba0e7 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -73,9 +73,9 @@ struct show_table_type_st sys_table_types[]=
"Alias for MEMORY", DB_TYPE_HEAP},
{"MEMORY", &have_yes,
"Hash based, stored in memory, useful for temporary tables", DB_TYPE_HEAP},
- {"MERGE", &have_yes,
+ {"MERGE", &have_merge_db,
"Collection of identical MyISAM tables", DB_TYPE_MRG_MYISAM},
- {"MRG_MYISAM",&have_yes,
+ {"MRG_MYISAM",&have_merge_db,
"Alias for MERGE", DB_TYPE_MRG_MYISAM},
{"ISAM", &have_isam,
"Obsolete storage engine, now replaced by MyISAM", DB_TYPE_ISAM},
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index d231942bb7a..b9faa062850 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -1021,7 +1021,7 @@ extern SHOW_COMP_OPTION have_query_cache, have_berkeley_db, have_innodb;
extern SHOW_COMP_OPTION have_geometry, have_rtree_keys;
extern SHOW_COMP_OPTION have_crypt;
extern SHOW_COMP_OPTION have_compress;
-extern SHOW_COMP_OPTION have_blackhole_db;
+extern SHOW_COMP_OPTION have_blackhole_db, have_merge_db;
#ifndef __WIN__
extern pthread_t signal_thread;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index fc3ca5085cf..0de8f005247 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -287,6 +287,7 @@ my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
my_bool opt_log_slave_updates= 0;
my_bool opt_console= 0, opt_bdb, opt_innodb, opt_isam, opt_ndbcluster;
+my_bool opt_merge;
#ifdef HAVE_NDBCLUSTER_DB
const char *opt_ndbcluster_connectstring= 0;
my_bool opt_ndb_shm, opt_ndb_optimized_node_selection;
@@ -420,7 +421,7 @@ CHARSET_INFO *system_charset_info, *files_charset_info ;
CHARSET_INFO *national_charset_info, *table_alias_charset;
SHOW_COMP_OPTION have_berkeley_db, have_innodb, have_isam, have_ndbcluster,
- have_example_db, have_archive_db, have_csv_db;
+ have_example_db, have_archive_db, have_csv_db, have_merge_db;
SHOW_COMP_OPTION have_raid, have_openssl, have_symlink, have_query_cache;
SHOW_COMP_OPTION have_geometry, have_rtree_keys;
SHOW_COMP_OPTION have_crypt, have_compress;
@@ -4345,7 +4346,8 @@ enum options_mysqld
OPT_DATETIME_FORMAT,
OPT_LOG_QUERIES_NOT_USING_INDEXES,
OPT_DEFAULT_TIME_ZONE,
- OPT_LOG_SLOW_ADMIN_STATEMENTS
+ OPT_LOG_SLOW_ADMIN_STATEMENTS,
+ OPT_MERGE
};
@@ -4705,6 +4707,9 @@ master-ssl",
#endif /* HAVE_REPLICATION */
{"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (gptr*) &locked_in_memory,
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"merge", OPT_MERGE, "Enable Merge storage engine. Disable with \
+--skip-merge.",
+ (gptr*) &opt_merge, (gptr*) &opt_merge, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0},
{"myisam-recover", OPT_MYISAM_RECOVER,
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
(gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0,
@@ -6468,6 +6473,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
have_berkeley_db= SHOW_OPTION_DISABLED;
#endif
break;
+ case OPT_MERGE:
+ have_merge_db= opt_merge ? SHOW_OPTION_YES : SHOW_OPTION_DISABLED;
+ break;
case OPT_ISAM:
#ifdef HAVE_ISAM
if (opt_isam)
diff --git a/sql/set_var.cc b/sql/set_var.cc
index c9cada7158a..a665a6dc3aa 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -738,6 +738,7 @@ struct show_var_st init_vars[]= {
{"have_innodb", (char*) &have_innodb, SHOW_HAVE},
{"have_isam", (char*) &have_isam, SHOW_HAVE},
{"have_ndbcluster", (char*) &have_ndbcluster, SHOW_HAVE},
+ {"have_merge_engine", (char*) &have_merge_db, SHOW_HAVE},
{"have_openssl", (char*) &have_openssl, SHOW_HAVE},
{"have_query_cache", (char*) &have_query_cache, SHOW_HAVE},
{"have_raid", (char*) &have_raid, SHOW_HAVE},