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

« back to all changes in this revision

Viewing changes to tests/regression/apparmor/link.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
#       Copyright (C) 2002-2005 Novell/SUSE
 
3
#
 
4
#       This program is free software; you can redistribute it and/or
 
5
#       modify it under the terms of the GNU General Public License as
 
6
#       published by the Free Software Foundation, version 2 of the
 
7
#       License.
 
8
 
 
9
#=NAME link
 
10
#=DESCRIPTION
 
11
# Link requires 'l' permission on the link and that permissions on the
 
12
#links rwmx perms are a subset of the targets perms, and if x is present
 
13
#that the link and target have the same x qualifiers.
 
14
# This test verifies matching, non-matching and missing link
 
15
# permissions in a profile.
 
16
#=END
 
17
 
 
18
pwd=`dirname $0`
 
19
pwd=`cd $pwd ; /bin/pwd`
 
20
 
 
21
bin=$pwd
 
22
 
 
23
. $bin/prologue.inc
 
24
 
 
25
target=$tmpdir/target
 
26
linkfile=$tmpdir/linkfile
 
27
okperm=rwixl
 
28
badperm=rwl
 
29
nolinkperm=rwix
 
30
 
 
31
 
 
32
PERMS="r w m ix px ux Px Ux l rw rm rix rpx rux rPx rUx rl wm wix wpx wux \
 
33
        wPx wUx wl mix mpx mux mPx mUx ml ixl pxl uxl Pxl Uxl rwm rwix rwpx \
 
34
        rwux rwPx rwUx rwl rmix rmpx rmux rmPx rmUx rml wmix wmpx wmux wmPx \
 
35
        wmUx wml mixl mpxl muxl mPxl mUxl rwmix rwmpx rwmux rwmPx rwmUx \
 
36
        rwml wmixl wmpxl wmuxl wmPxl wmUxl rwmixl rwmpxl rwmuxl rwmPxl \
 
37
        rwmUxl"
 
38
 
 
39
 
 
40
# unconfined test - no target file
 
41
runchecktest "unconfined - no target" fail $target $linkfile
 
42
 
 
43
touch $target
 
44
# unconfined test
 
45
runchecktest "unconfined" pass $target $linkfile
 
46
 
 
47
rm -rf $target
 
48
# Link no perms on link or target - no target file
 
49
genprofile
 
50
runchecktest "link no target (no perms) -> target (no perms)" fail $target $linkfile
 
51
rm -rf $linkfile
 
52
 
 
53
touch $target
 
54
# Link no perms on link or target 
 
55
runchecktest "link (no perms) -> target (no perms)" fail $target $linkfile
 
56
rm -rf $linkfile
 
57