| 1 |
--echo # |
| 2 |
--echo # Bug50373 --secure-file-priv="" |
| 3 |
--echo # |
| 4 |
CREATE TABLE t1 (c1 VARCHAR(50)); |
| 5 |
INSERT INTO t1 VALUES ("one"),("two"),("three"),("four"),("five"); |
| 6 |
SHOW VARIABLES LIKE 'secure_file_priv'; |
| 7 |
--disable_query_log |
| 8 |
|
| 9 |
# Atempt to create a file where we normally aren't allowed to create one. |
| 10 |
# |
| 11 |
# Doing this in a portable manner is difficult but we should be able to |
| 12 |
# count on the directory hierarchy used. A step up from MYSQLTEST_VARDIR |
| 13 |
# should definitely lead us to a "protected" directory, |
| 14 |
# but at the same time should still be writable since MTR was able |
| 15 |
# to create the vardir itself there. |
| 16 |
# If we run tests normally, it will be mysql-test directory. |
| 17 |
# If we run tests with --mem, it will be /dev/shm. |
| 18 |
# If we run tests with --parallel, it will be mysql-test/var |
| 19 |
# (because MYSQLTEST_VARDIR in this case is mysql-test/var/N). |
| 20 |
--disable_cursor_protocol |
| 21 |
|
| 22 |
--perl |
| 23 |
use File::Basename; |
| 24 |
my $protected_file= dirname($ENV{MYSQLTEST_VARDIR}).'/bug50373.txt'; |
| 25 |
# Ensure bug50373.txt does not exist (e.g. leftover from previous |
| 26 |
# test runs). |
| 27 |
unlink $protected_file; |
| 28 |
open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/bug50373.inc") or die; |
| 29 |
print FILE "SELECT * FROM t1 INTO OUTFILE '".$protected_file."';\n"; |
| 30 |
print FILE "DELETE FROM t1;\n"; |
| 31 |
print FILE "LOAD DATA INFILE '".$protected_file."' INTO TABLE t1;\n"; |
| 32 |
print FILE "SELECT * FROM t1;\n"; |
| 33 |
print FILE "SELECT load_file('",$protected_file,"') AS loaded_file;\n"; |
| 34 |
close(FILE); |
| 35 |
EOF |
| 36 |
|
| 37 |
--enable_prepare_warnings |
| 38 |
--source $MYSQL_TMP_DIR/bug50373.inc |
| 39 |
--disable_prepare_warnings |
| 40 |
--remove_file $MYSQL_TMP_DIR/bug50373.inc |
| 41 |
--enable_query_log |
| 42 |
|
| 43 |
--enable_cursor_protocol |
| 44 |
|
| 45 |
DROP TABLE t1; |
| 46 |
|
| 47 |
--perl |
| 48 |
use File::Basename; |
| 49 |
unlink dirname($ENV{MYSQLTEST_VARDIR}).'/bug50373.txt'; |
| 50 |
EOF |
| 51 |
|