1
#############################################################################
2
# Bug#17786581:SERVER WRITES INTO WORLD-WRITEABLE FILE EVEN AFTER WARNING ABOUT
7
# UUID exists in a file named "auto.cnf", make this auto.cnf file as world
8
# writable. The server starts, and it sees the auto.cnf is world writable and
9
# writes a following warning:
11
# Warning: World-writable con-fig file './auto.cnf' is ignored
13
# A new UUID is generated and the new UUID is once again written to the same
14
# world writable file which is not safe.
18
# During the execution of the script change file permissions of 'auto.cnf' to
19
# 777. Restart the server and check that the newly generated 'auto.cnf' file
20
# has valid 660 file permissions.
21
###############################################################################
22
# Run only on Linux:Since file permissions vary from one os to the other
23
# we execute this script only on linux to avoid test failures.
24
--source include/linux.inc
25
# include/restart_mysqld.inc does not work in embedded mode
26
--source include/not_embedded.inc
28
CALL mtr.add_suppression("World-writable config file './auto.cnf' is ignored");
29
CALL mtr.add_suppression("World-writable config file './auto.cnf' has been removed.");
31
# Change file permissions to world writable
32
--let $MYSQL_DATA_DIR=`select @@datadir`
33
--let _INPUT_FILE_=$MYSQL_DATA_DIR/auto.cnf
34
--let _FILE_PERMS_=0777
35
--source include/change_file_perms.inc
38
--source include/restart_mysqld.inc
40
# Check that it has 660 valid permissions.
43
my $input_file= $ENV{'_INPUT_FILE_'};
44
my $mode = (stat($input_file))[2];
45
open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/permissions.inc") or die;
46
my $perm= $mode & 07777;
47
print FILE "let \$FILE_PERMISSIONS= $perm;\n";
51
--source $MYSQL_TMP_DIR/permissions.inc
52
--remove_file $MYSQL_TMP_DIR/permissions.inc
54
--let $assert_cond= $FILE_PERMISSIONS= 432
55
--let $assert_text= File permissions should be equl to decimal 432(i.e octal 660).
56
--source include/assert.inc