2
# $Id: rename.sh 482 2007-03-23 18:33:25Z jrjohansen $
4
# Copyright (C) 2002-2005 Novell/SUSE
6
# This program is free software; you can redistribute it and/or
7
# modify it under the terms of the GNU General Public License as
8
# published by the Free Software Foundation, version 2 of the
13
# The rename system call changes the name of a file in the filesystem.
14
# The test verifies that this operation (which involves AppArmor write
15
# permission checks) functions correctly for a confined process.
19
pwd=`cd $pwd ; /bin/pwd`
39
test -d $dir1 || mkdir $dir1
46
genprofile $file1:$okfile1perm $file2:$okfile2perm $dir1:$okfile1perm $dir2:$okfile2perm
48
runchecktest "RENAME RW W" pass $file1 $file2
49
runchecktest "RENAME RW W (dir)" pass $dir1 $dir2
51
# FAILURE TEST (1) - Bad permissions on target
55
genprofile $file1:$okfile1perm $file2:$badfile2perm $dir1:$okfile1perm $dir2:$badfile2perm
57
runchecktest "RENAME RW R" fail $file1 $file2
58
runchecktest "RENAME RW R (dir)" fail $dir1 $dir2
60
# FAILURE TEST (2) - no permissions on target
64
genprofile $file1:$okfile1perm $dir1:$okfile1perm
66
runchecktest "RENAME RW -" fail $file1 $file2
67
runchecktest "RENAME RW - (dir)" fail $dir1 $dir2
69
# FAILURE TEST (3) - Bad permissions on source
73
genprofile $file1:$badfile1perm1 $file2:$okfile2perm $dir1:$badfile1perm1 $dir2:$okfile2perm
75
runchecktest "RENAME R W" fail $file1 $file2
76
runchecktest "RENAME R W (dir)" fail $dir1 $dir2
78
# FAILURE TEST (4) - Bad permissions on source
82
genprofile $file1:$badfile1perm2 $file2:$okfile2perm $dir1:$badfile1perm2 $dir2:$okfile2perm
84
runchecktest "RENAME W W" fail $file1 $file2
85
runchecktest "RENAME W W (dir)" fail $dir1 $dir2
87
# FAILURE TEST (5) - No permissions on source
91
genprofile $file2:$okfile2perm $dir2:$okfile2perm
93
runchecktest "RENAME - W" fail $file1 $file2
94
runchecktest "RENAME - W (dir)" fail $dir1 $dir2