]> Dogcows Code - chaz/tar/blob - tests/selacl01.at
Add SELinux context store/restore/list support.
[chaz/tar] / tests / selacl01.at
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
2 #
3 # Test suite for GNU tar.
4 # Copyright (C) 2011 Free Software Foundation, Inc.
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3, or (at your option)
9 # any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #
19 # Test description:
20 #
21 # This is basic test for support of extended attributes.
22
23 AT_SETUP([acls/selinux: special files & fifos])
24 AT_KEYWORDS([xattrs selinux acls selacls01])
25
26 AT_TAR_CHECK([
27 AT_PRIVILEGED_PREREQ
28 AT_XATTRS_UTILS_PREREQ
29 AT_SELINUX_PREREQ
30 AT_ACLS_PREREQ
31
32 mkdir dir
33 mkfifo dir/fifo
34 MAJOR=$( stat /dev/urandom --printf="%t" )
35 MINOR=$( stat /dev/urandom --printf="%T" )
36 mknod dir/chartype c $MAJOR $MINOR
37
38 # setup attributes
39 chcon -h --user=system_u dir/fifo
40 chcon -h --user=system_u dir/chartype
41 setfacl -m u:$UID:--- dir/fifo
42 setfacl -m u:$UID:rwx dir/chartype
43
44 getfacl dir/fifo >> before
45 getfattr -msecurity.selinux dir/chartype >> before
46
47 tar --xattrs --selinux --acls -cf archive.tar dir
48
49 mv dir olddir
50
51 tar --xattrs --selinux --acls -xf archive.tar
52
53 getfacl dir/fifo >> after
54 getfattr -msecurity.selinux dir/chartype >> after
55
56 diff before after
57 echo separator
58 ],
59 [0],
60 [separator
61 ])
62
63 AT_CLEANUP
This page took 0.044448 seconds and 5 git commands to generate.