4 # Test that xfsdump/restore preserves file capabilities
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2013 Red Hat, Inc. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #-----------------------------------------------------------------------
25 seqres=$RESULT_DIR/$seq
26 echo "QA output created by $seq"
30 status=1 # failure is the default!
31 trap "_cleanup; exit \$status" 0 1 2 3 15
39 # get standard environment, filters and checks
44 # real QA test starts here
46 # Modify as appropriate.
56 echo test > $dump_dir/testfile
58 setfattr -n user.name -v value $dump_dir/testfile
59 # Now set the cap (which is also an xattr)
60 setcap cap_setgid,cap_setuid+ep $dump_dir/testfile
61 # And make sure they are there on the source
62 echo "Checking for xattr on source file"
63 getfattr --absolute-names -m user.name $dump_dir/testfile | _dir_filter
64 echo "Checking for capability on source file"
65 getcap $dump_dir/testfile | _dir_filter
66 getfattr --absolute-names -m security.capability $dump_dir/testfile | _dir_filter
68 _do_dump_file -f $tmp.df.0
71 # Basic dump/restore checks first - the file is there, right?
75 echo "Checking for xattr on restored file"
76 getfattr --absolute-names -m user.name $restore_dir/$dump_sdir/testfile | _dir_filter
77 echo "Checking for capability on restored file"
78 getcap $restore_dir/$dump_sdir/testfile | _dir_filter
79 getfattr --absolute-names -m security.capability $restore_dir/$dump_sdir/testfile | _dir_filter