PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/zfs-tests/tests/functional/acl/posix/posix_003_pos.ksh

http://github.com/zfsonlinux/zfs
Korn Shell | 60 lines | 23 code | 6 blank | 31 comment | 2 complexity | 1a69d89fb0ce017e60363177d529834a MD5 | raw file
Possible License(s): Apache-2.0, MPL-2.0-no-copyleft-exception
  1. #!/bin/ksh -p
  2. #
  3. # CDDL HEADER START
  4. #
  5. # The contents of this file are subject to the terms of the
  6. # Common Development and Distribution License (the "License").
  7. # You may not use this file except in compliance with the License.
  8. #
  9. # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10. # or http://www.opensolaris.org/os/licensing.
  11. # See the License for the specific language governing permissions
  12. # and limitations under the License.
  13. #
  14. # When distributing Covered Code, include this CDDL HEADER in each
  15. # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16. # If applicable, add the following below this CDDL HEADER, with the
  17. # fields enclosed by brackets "[]" replaced with your own identifying
  18. # information: Portions Copyright [yyyy] [name of copyright owner]
  19. #
  20. # CDDL HEADER END
  21. #
  22. . $STF_SUITE/include/libtest.shlib
  23. #
  24. # DESCRIPTION:
  25. # Verify that ACLs survive remount.
  26. # Regression test for https://github.com/zfsonlinux/zfs/issues/4520
  27. #
  28. # STRATEGY:
  29. # 1. Test presence of default and regular ACLs after remount
  30. # a. Can set and list ACL before remount
  31. # b. Can list ACL after remount
  32. #
  33. verify_runnable "both"
  34. log_assert "Verify regular and default POSIX ACLs survive remount"
  35. typeset acl_str1="^group:$ZFS_ACL_STAFF_GROUP:-wx$"
  36. typeset acl_str2="^default:group:$ZFS_ACL_STAFF_GROUP:-wx$"
  37. typeset ACLDIR="$TESTDIR/dir.1"
  38. log_note "Testing access to DIRECTORY"
  39. log_must mkdir $ACLDIR
  40. log_must setfacl -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR
  41. log_must setfacl -d -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR
  42. getfacl $ACLDIR 2> /dev/null | egrep -q "$acl_str1"
  43. if [ "$?" -eq "0" ]; then
  44. getfacl $ACLDIR 2> /dev/null | egrep -q "$acl_str2"
  45. fi
  46. if [ "$?" -eq "0" ]; then
  47. log_must zfs unmount $TESTPOOL/$TESTFS
  48. log_must zfs mount $TESTPOOL/$TESTFS
  49. log_must eval "getfacl $ACLDIR 2> /dev/null | egrep -q \"$acl_str1\""
  50. log_must eval "getfacl $ACLDIR 2> /dev/null | egrep -q \"$acl_str2\""
  51. log_pass "POSIX ACLs survive remount"
  52. else
  53. log_fail "Group '$ZFS_ACL_STAFF_GROUP' does not have 'rwx'"
  54. fi