Line 0
Link Here
|
|
|
1 |
--- mysql-test/t/symlink.test 2005-12-08 15:13:53 +0000 |
2 |
+++ mysql-test/t/symlink.test 2008-02-29 12:56:41 +0000 |
3 |
@@ -119,18 +119,99 @@ |
4 |
drop table t1; |
5 |
|
6 |
# |
7 |
-# Test specifying DATA DIRECTORY that is the same as what would normally |
8 |
-# have been chosen. (Bug #8707) |
9 |
-# |
10 |
-disable_query_log; |
11 |
-eval create table t1 (i int) data directory = "$MYSQL_TEST_DIR/var/master-data/test/"; |
12 |
-enable_query_log; |
13 |
-show create table t1; |
14 |
-drop table t1; |
15 |
-disable_query_log; |
16 |
-eval create table t1 (i int) index directory = "$MYSQL_TEST_DIR/var/master-data/test/"; |
17 |
-enable_query_log; |
18 |
-show create table t1; |
19 |
-drop table t1; |
20 |
- |
21 |
-# End of 4.1 tests |
22 |
+# BUG#32111 - Security Breach via DATA/INDEX DIRECORY and RENAME TABLE |
23 |
+# |
24 |
+--write_file $MYSQLTEST_VARDIR/tmp/t1.MYI |
25 |
+EOF |
26 |
+--replace_result $MYSQLTEST_VARDIR TEST_DIR |
27 |
+--error 1 |
28 |
+eval CREATE TABLE t1(a INT) |
29 |
+DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' |
30 |
+INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp'; |
31 |
+--replace_result $MYSQLTEST_VARDIR TEST_DIR |
32 |
+eval CREATE TABLE t2(a INT) |
33 |
+DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' |
34 |
+INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp'; |
35 |
+--replace_result $MYSQLTEST_VARDIR TEST_DIR |
36 |
+--error 1 |
37 |
+RENAME TABLE t2 TO t1; |
38 |
+DROP TABLE t2; |
39 |
+--remove_file $MYSQLTEST_VARDIR/tmp/t1.MYI |
40 |
+ |
41 |
+# |
42 |
+# Bug#8706 - temporary table with data directory option fails |
43 |
+# |
44 |
+connect (session1,localhost,root,,); |
45 |
+connect (session2,localhost,root,,); |
46 |
+ |
47 |
+connection session1; |
48 |
+disable_query_log; |
49 |
+eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 9 a; |
50 |
+enable_query_log; |
51 |
+# If running test suite with a non standard tmp dir, the "show create table" |
52 |
+# will print "DATA_DIRECTORY=". Use replace_result to mask it out |
53 |
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR |
54 |
+show create table t1; |
55 |
+ |
56 |
+connection session2; |
57 |
+disable_query_log; |
58 |
+eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 99 a; |
59 |
+enable_query_log; |
60 |
+# If running test suite with a non standard tmp dir, the "show create table" |
61 |
+# will print "DATA_DIRECTORY=". Use replace_result to mask it out |
62 |
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR |
63 |
+show create table t1; |
64 |
+ |
65 |
+connection default; |
66 |
+create table t1 (a int) engine=myisam select 42 a; |
67 |
+ |
68 |
+connection session1; |
69 |
+select * from t1; |
70 |
+disconnect session1; |
71 |
+connection session2; |
72 |
+select * from t1; |
73 |
+disconnect session2; |
74 |
+connection default; |
75 |
+select * from t1; |
76 |
+drop table t1; |
77 |
+ |
78 |
+# |
79 |
+# CREATE TABLE with DATA DIRECTORY option |
80 |
+# |
81 |
+# Protect ourselves from data left in tmp/ by a previos possibly failed |
82 |
+# test |
83 |
+--system rm -f $MYSQLTEST_VARDIR/tmp/t1.* |
84 |
+--disable_query_log |
85 |
+eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'"; |
86 |
+--enable_query_log |
87 |
+execute stmt; |
88 |
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
89 |
+show create table t1; |
90 |
+drop table t1; |
91 |
+execute stmt; |
92 |
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
93 |
+show create table t1; |
94 |
+drop table t1; |
95 |
+deallocate prepare stmt; |
96 |
+ |
97 |
+# |
98 |
+# Bug#32167 another privilege bypass with DATA/INDEX DIRECORY |
99 |
+# |
100 |
+--replace_result $MYSQL_TEST_DIR TEST_DIR |
101 |
+--error 1210 |
102 |
+eval CREATE TABLE t1(a INT) |
103 |
+DATA DIRECTORY='$MYSQL_TEST_DIR/var/master-data/test'; |
104 |
+--replace_result $MYSQL_TEST_DIR TEST_DIR |
105 |
+--error 1210 |
106 |
+eval CREATE TABLE t1(a INT) |
107 |
+DATA DIRECTORY='$MYSQL_TEST_DIR/var/master-data/'; |
108 |
+--replace_result $MYSQL_TEST_DIR TEST_DIR |
109 |
+--error 1210 |
110 |
+eval CREATE TABLE t1(a INT) |
111 |
+INDEX DIRECTORY='$MYSQL_TEST_DIR/var/master-data'; |
112 |
+--replace_result $MYSQL_TEST_DIR TEST_DIR |
113 |
+--error 1 |
114 |
+eval CREATE TABLE t1(a INT) |
115 |
+INDEX DIRECTORY='$MYSQL_TEST_DIR/var/master-data_var'; |
116 |
+ |
117 |
+--echo End of 4.1 tests |
118 |
|