~apparmor-dev/apparmor/master

« back to all changes in this revision

Viewing changes to tests/regression/apparmor/fork.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 fork
10
 
#=DESCRIPTION 
11
 
# Verifies that profiles are duplicated correctly for fork (the subtask 
12
 
# receives a copy of it's parents profile).  The test attempts to access the 
13
 
# files passed as arguments for both a parent and a child.    The test is 
14
 
# repeated for permissive and restrictive profiles.
15
 
#=END
16
 
 
17
 
pwd=`dirname $0`
18
 
pwd=`cd $pwd ; /bin/pwd`
19
 
 
20
 
bin=$pwd
21
 
 
22
 
. $bin/prologue.inc
23
 
 
24
 
file1=$tmpdir/file1
25
 
file2=$tmpdir/file2
26
 
file3=$tmpdir/file3
27
 
cap=ipc_owner
28
 
okperm=rw
29
 
badperm=r
30
 
 
31
 
touch $file1 $file2 $file3
32
 
 
33
 
# TEST1
34
 
 
35
 
genprofile cap:$cap $file1:$okperm $file2:$okperm $file3:$okperm
36
 
 
37
 
runchecktest "FORK with rw" pass $file1 $file2 $file3
38
 
 
39
 
# TEST2.  All will fail, but parent and child will equally fail
40
 
 
41
 
genprofile cap:$cap $file1:$badperm $file2:$badperm $file3:$badperm
42
 
 
43
 
runchecktest "FORK w/o w" pass $file1 $file2 $file3
44
 
 
45
 
# TEST3.  Some pass, some fail, but parent and child will equally fail
46
 
 
47
 
genprofile cap:$cap $file1:$badperm $file2:$okperm $file3:$badperm
48
 
 
49
 
runchecktest "FORK mixed" pass $file1 $file2 $file3