Commit 39f9adfa authored by unknown's avatar unknown

--{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)

parent 17870724
......@@ -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
......
--skip-isam
--skip-isam --skip-merge
......@@ -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
#
......
......@@ -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},
......
......@@ -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;
......
......@@ -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)
......
......@@ -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},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment