apparmor/tests/regression/subdomain/unlink.sh
Steve Beattie 6d3e74907d Import the rest of the core functionality of the internal apparmor
development tree (trunk branch). From svn repo version 6381.
2006-04-11 21:52:54 +00:00

51 lines
999 B
Bash
Executable file

#! /bin/bash
# $Id: unlink.sh 6318 2006-03-10 01:56:00Z steve $
# Copyright (C) 2002-2005 Novell/SUSE
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, version 2 of the
# License.
#=NAME unlink
#=DESCRIPTION
# In order to unlink a file, a confined process must have 'w' permission in
# it's profile for the relevant file. This test verifies this.
#=END
pwd=`dirname $0`
pwd=`cd $pwd ; /bin/pwd`
bin=$pwd
. $bin/prologue.inc
file=$tmpdir/file
okperm=rwix
okperm2=w
nowriteperm=rixl
# PASS TEST
touch $file
genprofile $file:$okperm
runchecktest "w/ WRITE PERM" pass $file
test -f $file && rm -f $file
# PASS TEST
touch $file
genprofile $file:$okperm2
runchecktest "w/ ONLY WRITE PERM" pass $file
test -f $file && rm -f $file
# NO WRITE PERMTEST
touch $file
genprofile $file:$nowriteperm
runchecktest "No WRITE PERM" fail $file
test -f $file && rm -f $file