Print this page
7290 ZFS test suite needs to control what utilities it can run
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/test/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh
          +++ new/usr/src/test/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17  # fields enclosed by brackets "[]" replaced with your own identifying
  18   18  # information: Portions Copyright [yyyy] [name of copyright owner]
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
  22   22  # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23   23  # Use is subject to license terms.
  24   24  #
  25   25  
  26   26  #
  27      -# Copyright (c) 2013 by Delphix. All rights reserved.
       27 +# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  28   28  #
  29   29  
  30   30  . $STF_SUITE/include/libtest.shlib
  31   31  . $STF_SUITE/tests/functional/xattr/xattr_common.kshlib
  32   32  
  33   33  #
  34   34  # DESCRIPTION:
  35   35  #
  36   36  # Attempting to read an xattr on a file for which we have no permissions
  37   37  # should fail.
  38   38  #
  39   39  # STRATEGY:
  40   40  #       1. Create a file, and set an with an xattr
  41   41  #       2. Set the octal file permissions to 000 on the file.
  42   42  #       3. Check that we're unable to read the xattr as a non-root user
  43   43  #       4. Check that we're unable to write an xattr as a non-root user
  44   44  #
  45   45  
  46   46  function cleanup {
  47   47  
  48      -        log_must $RM $TESTDIR/myfile.$$
       48 +        log_must rm $TESTDIR/myfile.$$
  49   49  
  50   50  }
  51   51  
  52   52  log_assert "read/write xattr on a file with no permissions fails"
  53   53  log_onexit cleanup
  54   54  
  55      -log_must $TOUCH $TESTDIR/myfile.$$
       55 +log_must touch $TESTDIR/myfile.$$
  56   56  create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd
  57   57  
  58      -log_must $CHMOD 000 $TESTDIR/myfile.$$
  59      -log_mustnot $SU $ZFS_USER -c "$RUNAT $TESTDIR/myfile.$$ $CAT passwd"
  60      -log_mustnot $SU $ZFS_USER -c "$RUNAT $TESTDIR/myfile.$$ $CP /etc/passwd ."
       58 +log_must chmod 000 $TESTDIR/myfile.$$
       59 +log_mustnot su $ZFS_USER -c "runat $TESTDIR/myfile.$$ cat passwd"
       60 +log_mustnot su $ZFS_USER -c "runat $TESTDIR/myfile.$$ cp /etc/passwd ."
  61   61  
  62   62  log_pass "read/write xattr on a file with no permissions fails"
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX