~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to tests/regression/subdomain/changehat_fork.sh

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-04-27 10:38:07 UTC
  • mfrom: (5.1.118 natty)
  • Revision ID: james.westby@ubuntu.com-20110427103807-ym3rhwys6o84ith0
Tags: 2.6.1-2
debian/copyright: clarify for some full organization names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/bash
2
 
# $Id: changehat_fork.sh 61 2006-05-19 18:32:14Z steve-beattie $
3
 
 
4
 
#       Copyright (C) 2002-2005 Novell/SUSE
5
 
#
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
9
 
#       License.
10
 
 
11
 
#=NAME changehat_fork
12
 
#=DESCRIPTION 
13
 
# As 'changehat' but access checks for hats are verified across a fork
14
 
#=END
15
 
 
16
 
pwd=`dirname $0`
17
 
pwd=`cd $pwd ; /bin/pwd`
18
 
 
19
 
bin=$pwd
20
 
 
21
 
. $bin/prologue.inc
22
 
 
23
 
file=$tmpdir/file
24
 
subfile=$tmpdir/file2
25
 
okperm=rw
26
 
 
27
 
touch $file $subfile
28
 
 
29
 
# NO CHANGEHAT TEST
30
 
 
31
 
genprofile $file:$okperm
32
 
 
33
 
runchecktest "NO CHANGEHAT (access parent file)" pass nochange $file
34
 
runchecktest "NO CHANGEHAT (access sub file)" fail nochange $subfile
35
 
 
36
 
# CHANGEHAT TEST
37
 
 
38
 
subtest=sub
39
 
 
40
 
genprofile $file:$okperm hat:$subtest $subfile:$okperm
41
 
 
42
 
runchecktest "CHANGEHAT (access parent file)" fail $subtest $file
43
 
runchecktest "CHANGEHAT (access sub file)" pass $subtest $subfile
44
 
 
45
 
# CHANGEHAT TEST -- multiple subprofiles
46
 
 
47
 
subtest2=sub2
48
 
subtest3=sub3
49
 
 
50
 
genprofile $file:$okperm hat:$subtest $subfile:$okperm hat:$subtest2 $subfile:$okperm hat:$subtest3 $subfile:$okperm
51
 
 
52
 
runchecktest "CHANGEHAT (access parent file)" fail $subtest $file
53
 
runchecktest "CHANGEHAT (access sub file)" pass $subtest $subfile
54
 
runchecktest "CHANGEHAT (access sub file)" pass $subtest2 $subfile
55
 
runchecktest "CHANGEHAT (access sub file)" pass $subtest3 $subfile
56
 
 
57
 
# CHANGEHAT TEST -- non-existent subprofile access
58
 
# Should put us into a null-profile
59
 
 
60
 
subtest2=$test.sub2
61
 
subtest3=$test.sub3
62
 
 
63
 
genprofile $file:$okperm hat:$subtest $subfile:$okperm hat:$subtest2 $subfile:$okperm
64
 
 
65
 
runchecktest "CHANGEHAT (access parent file)" fail $subtest3 $file
66
 
runchecktest "CHANGEHAT (access sub file)" fail $subtest3 $subfile