2
# Copyright (C) 2002-2005 Novell/SUSE
3
# Copyright (C) 2017 Canonical, Ltd.
5
# This program is free software; you can redistribute it and/or
6
# modify it under the terms of the GNU General Public License as
7
# published by the Free Software Foundation, version 2 of the
12
# AppArmor requires 'r' permission on a directory in order for a confined task
13
# to be able to read the directory contents. This test verifies this.
17
pwd=`cd $pwd ; /bin/pwd`
24
# x is not really needed, see chdir.sh
30
# The readdir utility expects the return value to be passed as the
31
# second argument and returns success if the succeeding or failing calls
32
# match the expected value. It will fail the test if they don't, so for
33
# example the result differs acrorss getdents() and getdents64() this
37
genprofile $dir/:$okperm
38
runchecktest "READDIR" pass $dir 0
41
# READDIR TEST (no perm)
42
genprofile $dir/:$badperm
43
runchecktest "READDIR (no perm)" pass $dir ${EACCES}
45
# READDIR TEST (write perm) - ensure write perm isn't sufficient
47
runchecktest "READDIR (write perm)" pass $dir ${EACCES}
49
# this test is to make sure the raw 'file' rule allows access
52
runchecktest "READDIR 'file' dir" pass $dir 0
54
# this test is to make sure the raw 'file' rule allows access
57
runchecktest "READDIR 'file' '/'" pass '/' 0