~apparmor-dev/apparmor/master

« back to all changes in this revision

Viewing changes to tests/regression/apparmor/link_subset.sh

  • Committer: Steve Beattie
  • Date: 2019-02-19 09:38:13 UTC
  • Revision ID: sbeattie@ubuntu.com-20190219093813-ud526ee6hwn8nljz
The AppArmor project has been converted to git and is now hosted on
gitlab.

To get the converted repository, please do
  git clone https://gitlab.com/apparmor/apparmor

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/link_
27
 
 
28
 
tfiles=`$bin/link_subset --filenames $target`
29
 
lfiles=`$bin/link_subset --filenames $linkfile`
30
 
 
31
 
# unconfined test - no target file
32
 
#runchecktest "unconfined - no target" fail $target $linkfile
33
 
 
34
 
#touch $target
35
 
# unconfined test
36
 
#runchecktest "unconfined" pass $target $linkfile
37
 
 
38
 
#rm -rf $target
39
 
# Link no perms on link or target - no target file
40
 
#genprofile
41
 
#runchecktest "link no target (no perms) -> target (no perms)" fail $target $linkfile
42
 
#rm -rf $linkfile
43
 
 
44
 
touch $target
45
 
for f in $tfiles ; do touch ${f%%:*} ; done
46
 
 
47
 
# Link no perms on link or target
48
 
#runchecktest "link (no perms) -> target (no perms)" fail $target $linkfile
49
 
#rm -rf $linkfile
50
 
 
51
 
genprofile $tfiles $lfiles hat:remove_link /**:rw
52
 
runchecktest "link_subset" pass $target $linkfile
53
 
rm -rf $linkfile