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