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

« back to all changes in this revision

Viewing changes to tests/regression/subdomain/changehat.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.sh 291 2007-01-05 21:14:59Z jrjohansen $
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
12
 
#=DESCRIPTION 
13
 
# Verifies basic file access permission checks for a parent profile and one 
14
 
# subprofile/hat
15
 
#=END
16
 
 
17
 
pwd=`dirname $0`
18
 
pwd=`cd $pwd ; /bin/pwd`
19
 
 
20
 
bin=$pwd
21
 
 
22
 
. $bin/prologue.inc
23
 
 
24
 
file=$tmpdir/file
25
 
subfile=$tmpdir/file2
26
 
okperm=rw
27
 
 
28
 
subtest=sub
29
 
subtest2=sub2
30
 
subtest3=sub3
31
 
 
32
 
touch $file $subfile
33
 
 
34
 
# CHANGEHAT UNCONFINED
35
 
runchecktest "CHANGEHAT (unconfined - nochange)" pass nochange $file
36
 
runchecktest_errno EPERM "CHANGEHAT (unconfined)" fail $subtest $file
37
 
 
38
 
# NO CHANGEHAT TEST
39
 
genprofile $file:$okperm
40
 
 
41
 
runchecktest "NO CHANGEHAT (access parent file)" pass nochange $file
42
 
runchecktest "NO CHANGEHAT (access sub file)" fail nochange $subfile
43
 
 
44
 
# CHANGEHAT NO HATS TEST
45
 
runchecktest "CHAGEHAT (no hats, nochange)" pass nochange $file
46
 
runchecktest_errno ECHILD "CHANGEHAT (no hats, $file)" fail $subtest $file
47
 
runchecktest_errno ECHILD "CHANGEHAT (no hats, $subfile)" fail $subtest $subfile
48
 
 
49
 
# CHANGEHAT TEST
50
 
 
51
 
genprofile $file:$okperm hat:$subtest $subfile:$okperm
52
 
 
53
 
runchecktest "CHANGEHAT (access parent file)" fail $subtest $file
54
 
runchecktest "CHANGEHAT (access sub file)" pass $subtest $subfile
55
 
 
56
 
# CHANGEHAT TEST -- multiple subprofiles
57
 
 
58
 
genprofile $file:$okperm hat:$subtest $subfile:$okperm hat:$subtest2 $subfile:$okperm hat:$subtest3 $subfile:$okperm
59
 
 
60
 
runchecktest "CHANGEHAT (access parent file)" fail $subtest $file
61
 
runchecktest "CHANGEHAT (access sub file)" pass $subtest $subfile
62
 
runchecktest "CHANGEHAT (access sub file)" pass $subtest2 $subfile
63
 
runchecktest "CHANGEHAT (access sub file)" pass $subtest3 $subfile
64