selacl01.at 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. AT_SETUP([acls/selinux: special files & fifos])
  23. AT_KEYWORDS([xattrs selinux acls selacls01])
  24. AT_TAR_CHECK([
  25. AT_PRIVILEGED_PREREQ
  26. AT_XATTRS_UTILS_PREREQ
  27. AT_SELINUX_PREREQ
  28. AT_ACLS_PREREQ
  29. mkdir dir
  30. mkfifo dir/fifo
  31. MAJOR=$( stat /dev/urandom --printf="%t" )
  32. MINOR=$( stat /dev/urandom --printf="%T" )
  33. mknod dir/chartype c $MAJOR $MINOR
  34. # setup attributes
  35. restorecon -R dir
  36. chcon -h --user=system_u dir/fifo
  37. chcon -h --user=system_u dir/chartype
  38. setfacl -m u:$UID:--- dir/fifo
  39. setfacl -m u:$UID:rwx dir/chartype
  40. getfacl dir/fifo >> before
  41. getfattr -msecurity.selinux dir/chartype >> before
  42. tar --xattrs --selinux --acls -cf archive.tar dir
  43. mv dir olddir
  44. tar --xattrs --selinux --acls -xf archive.tar
  45. getfacl dir/fifo >> after
  46. getfattr -msecurity.selinux dir/chartype >> after
  47. diff before after
  48. echo separator
  49. ],
  50. [0],
  51. [separator
  52. ])
  53. AT_CLEANUP