10.t revision 166065
1166065Spjd#!/bin/sh 2166065Spjd# $FreeBSD: head/tools/regression/fstest/tests/chflags/10.t 166065 2007-01-17 01:42:12Z pjd $ 3166065Spjd 4166065Spjddesc="chflags returns EPERM if non-super-user tries to set one of SF_IMMUTABLE, SF_APPEND, or SF_NOUNLINK" 5166065Spjd 6166065Spjddir=`dirname $0` 7166065Spjd. ${dir}/../misc.sh 8166065Spjd 9166065Spjdrequire chflags 10166065Spjd 11166065Spjdecho "1..62" 12166065Spjd 13166065Spjdn0=`namegen` 14166065Spjdn1=`namegen` 15166065Spjdn2=`namegen` 16166065Spjd 17166065Spjdexpect 0 mkdir ${n0} 0755 18166065Spjdcdir=`pwd` 19166065Spjdcd ${n0} 20166065Spjd 21166065Spjdexpect 0 create ${n1} 0644 22166065Spjdexpect 0 chown ${n1} 65534 65534 23166065Spjdfor flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do 24166065Spjd expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag} 25166065Spjd expect none stat ${n1} flags 26166065Spjd expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag} 27166065Spjd expect none stat ${n1} flags 28166065Spjddone 29166065Spjdexpect 0 unlink ${n1} 30166065Spjd 31166065Spjdexpect 0 mkdir ${n1} 0755 32166065Spjdexpect 0 chown ${n1} 65534 65534 33166065Spjdfor flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do 34166065Spjd expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag} 35166065Spjd expect none stat ${n1} flags 36166065Spjd expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag} 37166065Spjd expect none stat ${n1} flags 38166065Spjddone 39166065Spjdexpect 0 rmdir ${n1} 40166065Spjd 41166065Spjdexpect 0 mkfifo ${n1} 0644 42166065Spjdexpect 0 chown ${n1} 65534 65534 43166065Spjdfor flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do 44166065Spjd expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag} 45166065Spjd expect none stat ${n1} flags 46166065Spjd expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag} 47166065Spjd expect none stat ${n1} flags 48166065Spjddone 49166065Spjdexpect 0 unlink ${n1} 50166065Spjd 51166065Spjdexpect 0 symlink ${n2} ${n1} 52166065Spjdexpect 0 lchown ${n1} 65534 65534 53166065Spjdfor flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do 54166065Spjd expect EPERM -u 65533 -g 65533 lchflags ${n1} ${flag} 55166065Spjd expect none lstat ${n1} flags 56166065Spjd expect EPERM -u 65534 -g 65534 lchflags ${n1} ${flag} 57166065Spjd expect none lstat ${n1} flags 58166065Spjddone 59166065Spjdexpect 0 unlink ${n1} 60166065Spjd 61166065Spjdcd ${cdir} 62166065Spjdexpect 0 rmdir ${n0} 63