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

« back to all changes in this revision

Viewing changes to tests/regression/subdomain/mkdir.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: mkdir.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 mkdir
12
 
#=DESCRIPTION mkdir() and rmdir() test
13
 
 
14
 
pwd=`dirname $0`
15
 
pwd=`cd $pwd ; /bin/pwd`
16
 
 
17
 
bin=$pwd
18
 
 
19
 
. $bin/prologue.inc
20
 
 
21
 
dir=$tmpdir/tmpdir
22
 
perms=w
23
 
excess_perms=wl
24
 
badperms=r
25
 
 
26
 
# mkdir TEST
27
 
 
28
 
# null profile, verify mkdir/rmdir fail
29
 
genprofile
30
 
 
31
 
runchecktest "MKDIR (confined - no perms)" fail mkdir $dir
32
 
 
33
 
# yeah, looks like NOP, but pass/fail of first shouldn't affect second
34
 
# use || : to avoid shell trap error if dir doesn't exist
35
 
/bin/rmdir $dir 2> /dev/null || :
36
 
/bin/mkdir $dir
37
 
 
38
 
runchecktest "RMDIR (confined - no perms)" fail rmdir $dir
39
 
 
40
 
# profile with read-only permissions, fail
41
 
 
42
 
genprofile $dir:$badperms
43
 
 
44
 
/bin/rmdir $dir 2> /dev/null || :
45
 
runchecktest "MKDIR (confined read-only)" fail mkdir $dir
46
 
 
47
 
# yeah, looks like NOP, but pass/fail of first shouldn't affect second
48
 
/bin/rmdir $dir 2> /dev/null || :
49
 
/bin/mkdir $dir
50
 
 
51
 
runchecktest "RMDIR (confined read-only)" fail rmdir $dir
52
 
 
53
 
# profile with permissions, shouldn't fail
54
 
 
55
 
genprofile $dir:$perms
56
 
 
57
 
/bin/rmdir $dir 2> /dev/null || :
58
 
runchecktest "MKDIR (confined)" pass mkdir $dir
59
 
 
60
 
# yeah, looks like NOP, but pass/fail of first shouldn't affect second
61
 
/bin/rmdir $dir 2> /dev/null || :
62
 
/bin/mkdir $dir
63
 
 
64
 
runchecktest "RMDIR (confined)" pass rmdir $dir
65
 
 
66
 
# profile with excess permissions, shouldn't fail
67
 
 
68
 
genprofile $dir:$excess_perms
69
 
 
70
 
/bin/rmdir $dir 2> /dev/null || :
71
 
runchecktest "MKDIR (confined +l)" pass mkdir $dir
72
 
 
73
 
# yeah, looks like NOP, but pass/fail of first shouldn't affect second
74
 
/bin/rmdir $dir 2> /dev/null || :
75
 
/bin/mkdir $dir
76
 
 
77
 
runchecktest "RMDIR (confined +l)" pass rmdir $dir