aboutsummaryrefslogtreecommitdiff
path: root/tests/chflags/11.t
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2014-09-09 02:50:09 +0000
committerEnji Cooper <ngie@FreeBSD.org>2014-09-09 02:50:09 +0000
commit9a56205fc912cc30c498cd8ab536eef96373b16f (patch)
treebd5f561604ac7481d7b8cdb06fb9cc3ba6e1512d /tests/chflags/11.t
downloadsrc-9a56205fc912cc30c498cd8ab536eef96373b16f.tar.gz
src-9a56205fc912cc30c498cd8ab536eef96373b16f.zip
This vendor import code was obtained from https://github.com/pjd/pjdfstest/commit/abf03c3a47745d4521b0e4aa141317553ca48f91 Approved by: rpaulo (mentor) Phabric: D743 Sponsored by: EMC / Isilon Storage Division
Notes
Notes: svn path=/vendor/pjdfstest/dist/; revision=271294 svn path=/vendor/pjdfstest/abf03c3a47745d4521b0e4aa141317553ca48f91/; revision=271295; tag=vendor/pjdfstest/abf03c3a47745d4521b0e4aa141317553ca48f91
Diffstat (limited to 'tests/chflags/11.t')
-rw-r--r--tests/chflags/11.t58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/chflags/11.t b/tests/chflags/11.t
new file mode 100644
index 000000000000..33acca7f327a
--- /dev/null
+++ b/tests/chflags/11.t
@@ -0,0 +1,58 @@
+#!/bin/sh
+# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/11.t 211352 2010-08-15 21:24:17Z pjd $
+
+desc="chflags returns EPERM if a user tries to set or remove the SF_SNAPSHOT flag"
+
+dir=`dirname $0`
+. ${dir}/../misc.sh
+
+require chflags_SF_SNAPSHOT
+
+echo "1..145"
+
+n0=`namegen`
+n1=`namegen`
+n2=`namegen`
+
+expect 0 mkdir ${n0} 0755
+cdir=`pwd`
+cd ${n0}
+
+for type in regular dir fifo block char socket symlink; do
+ if [ "${type}" != "symlink" ]; then
+ create_file ${type} ${n1}
+ expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
+ expect none stat ${n1} flags
+ expect EPERM chflags ${n1} SF_SNAPSHOT
+ expect none stat ${n1} flags
+ expect 0 chown ${n1} 65534 65534
+ expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
+ expect none stat ${n1} flags
+ expect EPERM chflags ${n1} SF_SNAPSHOT
+ expect none stat ${n1} flags
+ if [ "${type}" = "dir" ]; then
+ expect 0 rmdir ${n1}
+ else
+ expect 0 unlink ${n1}
+ fi
+ fi
+
+ create_file ${type} ${n1}
+ expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT
+ expect none lstat ${n1} flags
+ expect EPERM lchflags ${n1} SF_SNAPSHOT
+ expect none lstat ${n1} flags
+ expect 0 lchown ${n1} 65534 65534
+ expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT
+ expect none lstat ${n1} flags
+ expect EPERM lchflags ${n1} SF_SNAPSHOT
+ expect none lstat ${n1} flags
+ if [ "${type}" = "dir" ]; then
+ expect 0 rmdir ${n1}
+ else
+ expect 0 unlink ${n1}
+ fi
+done
+
+cd ${cdir}
+expect 0 rmdir ${n0}