1166065Spjd#!/bin/sh 2166065Spjd# $FreeBSD$ 3166065Spjd 4166065Spjddesc="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" 5166065Spjd 6166065Spjddir=`dirname $0` 7166065Spjd. ${dir}/../misc.sh 8166065Spjd 9166065Spjdrequire chflags 10166065Spjd 11211290Spjdecho "1..93" 12166065Spjd 13166065Spjdn0=`namegen` 14166065Spjdn1=`namegen` 15166065Spjdn2=`namegen` 16166065Spjd 17166065Spjdexpect 0 mkdir ${n0} 0755 18166065Spjdcdir=`pwd` 19166065Spjdcd ${n0} 20166065Spjd 21211290Spjdfor type in regular dir fifo block char socket symlink; do 22211290Spjd if [ "${type}" != "symlink" ]; then 23211290Spjd create_file ${type} ${n1} 24211290Spjd expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP 25211290Spjd expect none stat ${n1} flags 26211290Spjd expect 0 chown ${n1} 65534 65534 27211290Spjd expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP 28211290Spjd expect none stat ${n1} flags 29211290Spjd if [ "${type}" = "dir" ]; then 30211290Spjd expect 0 rmdir ${n1} 31211290Spjd else 32211290Spjd expect 0 unlink ${n1} 33211290Spjd fi 34211290Spjd fi 35166065Spjd 36211290Spjd create_file ${type} ${n1} 37211290Spjd expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP 38211290Spjd expect none lstat ${n1} flags 39211290Spjd expect 0 lchown ${n1} 65534 65534 40211290Spjd expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP 41211290Spjd expect none lstat ${n1} flags 42211290Spjd if [ "${type}" = "dir" ]; then 43211290Spjd expect 0 rmdir ${n1} 44211290Spjd else 45211290Spjd expect 0 unlink ${n1} 46211290Spjd fi 47211290Spjddone 48166065Spjd 49166065Spjdcd ${cdir} 50166065Spjdexpect 0 rmdir ${n0} 51