]> Dogcows Code - chaz/tar/blob - tests/selacl01.at
Bugfixes.
[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 restorecon -R dir
40 chcon -h --user=system_u dir/fifo
41 chcon -h --user=system_u dir/chartype
42 setfacl -m u:$UID:--- dir/fifo
43 setfacl -m u:$UID:rwx dir/chartype
44
45 getfacl dir/fifo >> before
46 getfattr -msecurity.selinux dir/chartype >> before
47
48 tar --xattrs --selinux --acls -cf archive.tar dir
49
50 mv dir olddir
51
52 tar --xattrs --selinux --acls -xf archive.tar
53
54 getfacl dir/fifo >> after
55 getfattr -msecurity.selinux dir/chartype >> after
56
57 diff before after
58 echo separator
59 ],
60 [0],
61 [separator
62 ])
63
64 AT_CLEANUP
This page took 0.0421 seconds and 5 git commands to generate.