4 # Test clearing of capabilities on write.
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
8 # Copyright (c) 2017 Google, Inc. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #-----------------------------------------------------------------------
27 seqres=$RESULT_DIR/$seq
31 status=1 # FAILure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 15
34 # get standard environment, filters and checks
41 [ -n "$TEST_DIR" ] && rm -f $file
46 sed -e "s#$file#file#"
49 # real QA test starts here
56 _require_test_program "writemod"
57 _require_command "$SETCAP_PROG" "setcap"
58 _require_command "$GETCAP_PROG" "getcap"
62 echo "QA output created by $seq"
64 file=$TEST_DIR/$seq.file
69 echo "**** Verifying that appending to file clears capabilities ****"
70 $SETCAP_PROG cap_chown+ep $file
71 $GETCAP_PROG $file | filefilter
74 $GETCAP_PROG $file | filefilter
77 echo "**** Verifying that appending to file doesn't clear other xattrs ****"
78 $SETCAP_PROG cap_chown+ep $file
79 $SETFATTR_PROG -n trusted.name -v value $file
82 $GETFATTR_PROG -m '^trusted\.*' --absolute-names $file | filefilter
84 echo "**** Verifying that chmod doesn't affect open file descriptors ****"
89 su $qa_user -c "src/writemod $file" | filefilter