1#!/bin/sh 2# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/07.t 211352 2010-08-15 21:24:17Z pjd $ 3 4desc="chflags returns EPERM when the effective user ID does not match the owner of the file and the effective user ID is not the super-user" 5 6dir=`dirname $0` 7. ${dir}/../misc.sh 8 9require chflags 10 11echo "1..93" 12 13n0=`namegen` 14n1=`namegen` 15n2=`namegen` 16 17expect 0 mkdir ${n0} 0755 18cdir=`pwd` 19cd ${n0} 20 21for type in regular dir fifo block char socket symlink; do 22 if [ "${type}" != "symlink" ]; then 23 create_file ${type} ${n1} 24 expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP 25 expect none stat ${n1} flags 26 expect 0 chown ${n1} 65534 65534 27 expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP 28 expect none stat ${n1} flags 29 if [ "${type}" = "dir" ]; then 30 expect 0 rmdir ${n1} 31 else 32 expect 0 unlink ${n1} 33 fi 34 fi 35 36 create_file ${type} ${n1} 37 expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP 38 expect none lstat ${n1} flags 39 expect 0 lchown ${n1} 65534 65534 40 expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP 41 expect none lstat ${n1} flags 42 if [ "${type}" = "dir" ]; then 43 expect 0 rmdir ${n1} 44 else 45 expect 0 unlink ${n1} 46 fi 47done 48 49cd ${cdir} 50expect 0 rmdir ${n0} 51