1#!/bin/sh 2# $FreeBSD: src/tools/regression/fstest/tests/chflags/07.t,v 1.1 2007/01/17 01:42:08 pjd Exp $ 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 6n0=`namegen` 7n1=`namegen` 8n2=`namegen` 9 10expect 0 mkdir ${n0} 0755 11cdir=`pwd` 12cd ${n0} 13 14expect 0 create ${n1} 0644 15expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE 16expect none stat ${n1} flags 17expect 0 chown ${n1} 65534 65534 18expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE 19expect none stat ${n1} flags 20expect 0 unlink ${n1} 21 22expect 0 mkdir ${n1} 0755 23expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE 24expect none stat ${n1} flags 25expect 0 chown ${n1} 65534 65534 26expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE 27expect none stat ${n1} flags 28expect 0 rmdir ${n1} 29 30expect 0 mkfifo ${n1} 0644 31expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE 32expect none stat ${n1} flags 33expect 0 chown ${n1} 65534 65534 34expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE 35expect none stat ${n1} flags 36expect 0 unlink ${n1} 37 38expect 0 symlink ${n2} ${n1} 39expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_IMMUTABLE 40expect none lstat ${n1} flags 41expect 0 lchown ${n1} 65534 65534 42expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_IMMUTABLE 43expect none lstat ${n1} flags 44expect 0 unlink ${n1} 45 46cd ${cdir} 47expect 0 rmdir ${n0} 48