diff options
author | unknown <gluh@mysql.com/eagle.(none)> | 2008-02-28 16:46:52 +0400 |
---|---|---|
committer | unknown <gluh@mysql.com/eagle.(none)> | 2008-02-28 16:46:52 +0400 |
commit | 1af419436456808d05063810dfbeb11ac6aae9aa (patch) | |
tree | 27bc731a8940e594404bf9434eaf2ea42c43308e /sql/partition_info.cc | |
parent | 9c0ee58fc4db70b2189902beec1e9056213cde3f (diff) | |
download | mariadb-git-1af419436456808d05063810dfbeb11ac6aae9aa.tar.gz |
Bug#32167 another privilege bypass with DATA/INDEX DIRECORY(3rd version for 5.1)
added new function test_if_data_home_dir() which checks that
path does not contain mysql data home directory.
Using of 'mysql data home'/'any db name' in
DATA DIRECTORY & INDEX DIRECTORY is disallowed
mysql-test/r/partition.result:
test result
mysql-test/r/partition_not_windows.result:
result fix
mysql-test/r/partition_symlink.result:
result fix
mysql-test/r/symlink.result:
test result update
mysql-test/t/partition.test:
test case
mysql-test/t/partition_not_windows.test:
test case update
mysql-test/t/partition_symlink.test:
test case update
mysql-test/t/symlink.test:
test case
sql/mysql_priv.h:
new variable mysql_unpacked_real_data_home
sql/mysqld.cc:
new variable mysql_unpacked_real_data_home
sql/partition_info.cc:
new check_partition_dirs() which checks
data directory and index directory for partition elements
sql/partition_info.h:
new check_partition_dirs() which checks
data directory and index directory for partition elements
sql/sql_parse.cc:
added new function test_if_data_home_dir() which checks that
path does not contain mysql data home directory.
Using of 'mysql data home'/'any db name' in
DATA DIRECTORY & INDEX DIRECTORY is disallowed
Diffstat (limited to 'sql/partition_info.cc')
-rw-r--r-- | sql/partition_info.cc | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 3b580422da1..3130f84bd73 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -1047,4 +1047,60 @@ error: mem_alloc_error(size); DBUG_RETURN(TRUE); } + + +/* + Check if path does not contain mysql data home directory + for partition elements with data directory and index directory + + SYNOPSIS + check_partition_dirs() + part_info partition_info struct + + RETURN VALUES + 0 ok + 1 error +*/ + +bool check_partition_dirs(partition_info *part_info) +{ + if (!part_info) + return 0; + + partition_element *part_elem; + List_iterator<partition_element> part_it(part_info->partitions); + while ((part_elem= part_it++)) + { + if (part_elem->subpartitions.elements) + { + List_iterator<partition_element> sub_it(part_elem->subpartitions); + partition_element *subpart_elem; + while ((subpart_elem= sub_it++)) + { + if (test_if_data_home_dir(subpart_elem->data_file_name)) + goto dd_err; + if (test_if_data_home_dir(subpart_elem->index_file_name)) + goto id_err; + } + } + else + { + if (test_if_data_home_dir(part_elem->data_file_name)) + goto dd_err; + if (test_if_data_home_dir(part_elem->index_file_name)) + goto id_err; + } + } + return 0; + +dd_err: + my_error(ER_WRONG_ARGUMENTS,MYF(0),"DATA DIRECORY"); + return 1; + +id_err: + my_error(ER_WRONG_ARGUMENTS,MYF(0),"INDEX DIRECORY"); + return 1; +} + + #endif /* WITH_PARTITION_STORAGE_ENGINE */ |