~ubuntu-branches/ubuntu/utopic/mysql-5.6/utopic-proposed

« back to all changes in this revision

Viewing changes to mysql-test/t/check_auto_permission.test

  • Committer: Package Import Robot
  • Author(s): James Page, Bjoern Boschman
  • Date: 2014-07-21 14:01:12 UTC
  • mfrom: (5.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20140721140112-1yqdrd6ds8y7nt76
Tags: 5.6.19-1~exp1
[ Bjoern Boschman ]
* SECURITY UPDATE: New upstream release (LP: #1330168).
  - www.oracle.com/technetwork/topics/security/cpujul2014-1972956.html
  - CVE-2014-2484
  - CVE-2014-4258
  - CVE-2014-4260
  - CVE-2014-4238
  - CVE-2014-4233
  - CVE-2014-4240
  - CVE-2014-4214

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#############################################################################
 
2
# Bug#17786581:SERVER WRITES INTO WORLD-WRITEABLE FILE EVEN AFTER WARNING ABOUT
 
3
# IT.
 
4
#
 
5
# Problem:
 
6
# ========
 
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:
 
10
#
 
11
# Warning: World-writable con-fig file './auto.cnf' is ignored
 
12
#
 
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.
 
15
#
 
16
# Test:
 
17
# =====
 
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
 
27
 
 
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.");
 
30
 
 
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
 
36
 
 
37
# Restart the server
 
38
--source include/restart_mysqld.inc
 
39
 
 
40
# Check that it has 660 valid permissions.
 
41
--perl
 
42
 use strict;
 
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";
 
48
 close FILE;
 
49
EOF
 
50
 
 
51
--source $MYSQL_TMP_DIR/permissions.inc
 
52
--remove_file $MYSQL_TMP_DIR/permissions.inc
 
53
 
 
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
 
57
 
 
58
# Clear
 
59
--let _FILE_PERMS_=
 
60
--let _INPUT_FILE_=