4
0

selacl01.at 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. #
  3. # Test suite for GNU tar.
  4. # Copyright 2011-2023 Free Software Foundation, Inc.
  5. # This file is part of GNU tar.
  6. # GNU tar 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 of the License, or
  9. # (at your option) any later version.
  10. # GNU tar is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #
  17. # Test description:
  18. #
  19. # This is basic test for support of extended attributes.
  20. AT_SETUP([acls/selinux: special files & fifos])
  21. AT_KEYWORDS([xattrs selinux acls selacls01])
  22. AT_TAR_CHECK([
  23. AT_PRIVILEGED_PREREQ
  24. AT_XATTRS_UTILS_PREREQ
  25. AT_SELINUX_PREREQ
  26. AT_ACLS_PREREQ
  27. mkdir dir
  28. mkfifo dir/fifo
  29. MAJOR=$( stat /dev/urandom --printf="%t" )
  30. MINOR=$( stat /dev/urandom --printf="%T" )
  31. mknod dir/chartype c $MAJOR $MINOR
  32. # setup attributes
  33. restorecon -R dir
  34. chcon -h --user=system_u dir/fifo
  35. chcon -h --user=system_u dir/chartype
  36. setfacl -m u:$UID:--- dir/fifo
  37. setfacl -m u:$UID:rwx dir/chartype
  38. getfacl dir/fifo >> before
  39. getfattr -msecurity.selinux dir/chartype >> before
  40. tar --xattrs --selinux --acls -cf archive.tar dir
  41. mv dir olddir
  42. tar --xattrs --selinux --acls -xf archive.tar
  43. getfacl dir/fifo >> after
  44. getfattr -msecurity.selinux dir/chartype >> after
  45. diff before after
  46. echo separator
  47. ],
  48. [0],
  49. [separator
  50. ])
  51. AT_CLEANUP