1#!/bin/sh
| 1#!/bin/sh
|
2# $FreeBSD: head/tools/regression/fstest/tests/chflags/11.t 211180 2010-08-11 16:34:44Z pjd $
| 2# $FreeBSD: head/tools/regression/fstest/tests/chflags/11.t 211186 2010-08-11 17:34:58Z pjd $
|
3 4desc="chflags returns EPERM if a user tries to set or remove the SF_SNAPSHOT flag" 5 6dir=`dirname $0` 7. ${dir}/../misc.sh 8 9require chflags_SF_SNAPSHOT 10
| 3 4desc="chflags returns EPERM if a user tries to set or remove the SF_SNAPSHOT flag" 5 6dir=`dirname $0` 7. ${dir}/../misc.sh 8 9require chflags_SF_SNAPSHOT 10
|
11echo "1..158"
| 11echo "1..145"
|
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
| 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} 0 0
| 23 create_file ${type} ${n1}
|
24 expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT 25 expect none stat ${n1} flags 26 expect EPERM chflags ${n1} SF_SNAPSHOT 27 expect none stat ${n1} flags 28 expect 0 chown ${n1} 65534 65534 29 expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT 30 expect none stat ${n1} flags 31 expect EPERM chflags ${n1} SF_SNAPSHOT 32 expect none stat ${n1} flags 33 if [ "${type}" = "dir" ]; then 34 expect 0 rmdir ${n1} 35 else 36 expect 0 unlink ${n1} 37 fi 38 fi 39
| 24 expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT 25 expect none stat ${n1} flags 26 expect EPERM chflags ${n1} SF_SNAPSHOT 27 expect none stat ${n1} flags 28 expect 0 chown ${n1} 65534 65534 29 expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT 30 expect none stat ${n1} flags 31 expect EPERM chflags ${n1} SF_SNAPSHOT 32 expect none stat ${n1} flags 33 if [ "${type}" = "dir" ]; then 34 expect 0 rmdir ${n1} 35 else 36 expect 0 unlink ${n1} 37 fi 38 fi 39
|
40 create_file ${type} ${n1} 0 0
| 40 create_file ${type} ${n1}
|
41 expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT 42 expect none lstat ${n1} flags 43 expect EPERM lchflags ${n1} SF_SNAPSHOT 44 expect none lstat ${n1} flags 45 expect 0 lchown ${n1} 65534 65534 46 expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT 47 expect none lstat ${n1} flags 48 expect EPERM lchflags ${n1} SF_SNAPSHOT 49 expect none lstat ${n1} flags 50 if [ "${type}" = "dir" ]; then 51 expect 0 rmdir ${n1} 52 else 53 expect 0 unlink ${n1} 54 fi 55done 56 57cd ${cdir} 58expect 0 rmdir ${n0}
| 41 expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT 42 expect none lstat ${n1} flags 43 expect EPERM lchflags ${n1} SF_SNAPSHOT 44 expect none lstat ${n1} flags 45 expect 0 lchown ${n1} 65534 65534 46 expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT 47 expect none lstat ${n1} flags 48 expect EPERM lchflags ${n1} SF_SNAPSHOT 49 expect none lstat ${n1} flags 50 if [ "${type}" = "dir" ]; then 51 expect 0 rmdir ${n1} 52 else 53 expect 0 unlink ${n1} 54 fi 55done 56 57cd ${cdir} 58expect 0 rmdir ${n0}
|