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

« back to all changes in this revision

Viewing changes to tests/regression/apparmor/named_pipe.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 named_pipe
 
10
#=DESCRIPTION 
 
11
# This test verifies that subdomain file access checks function correctly 
 
12
# for named piped (nodes in the filesystem created with mknod).  The test 
 
13
# creates a parent/child process relationship which attempt to rendevous via 
 
14
# the named pipe.   The tests are attempted for unconfined and confined 
 
15
# processes and also for subhats.
 
16
#=END
 
17
 
 
18
pwd=`dirname $0`
 
19
pwd=`cd $pwd ; /bin/pwd`
 
20
 
 
21
bin=$pwd
 
22
 
 
23
. $bin/prologue.inc
 
24
 
 
25
subtest=sub
 
26
fifo=${tmpdir}/pipe
 
27
okperm=rw
 
28
 
 
29
mknod ${fifo} p
 
30
 
 
31
# NAMED PIPE - no confinement 
 
32
 
 
33
runchecktest "NAMED PIPE (no confinement)" pass nochange ${fifo}
 
34
 
 
35
# PIPE - confined.
 
36
 
 
37
#rm -f ${fifo} && mknod ${fifo} p
 
38
genprofile $fifo:${okperm}
 
39
runchecktest "NAMED PIPE RW (confinement)" pass nochange ${fifo}
 
40
 
 
41
# PIPE - confined - no access.
 
42
 
 
43
#rm -f ${fifo} && mknod ${fifo} p
 
44
genprofile 
 
45
runchecktest "NAMED PIPE (confinement)" fail nochange ${fifo}
 
46
 
 
47
# PIPE - in a subprofile.
 
48
 
 
49
#rm -f ${fifo} && mknod ${fifo} p
 
50
genprofile ${fifo}:${okperm} hat:$subtest ${fifo}:${okperm}
 
51
 
 
52
runchecktest "NAMED PIPE RW (subprofile)" pass ${subtest} ${fifo}
 
53
 
 
54
# PIPE - in a subprofile - no access
 
55
 
 
56
#rm -f ${fifo} && mknod ${fifo} p
 
57
genprofile ${fifo}:${okperm} hat:$subtest
 
58
 
 
59
runchecktest "NAMED PIPE (subprofile)" fail ${subtest} ${fifo}