More and more tests.
This commit is contained in:
parent
35f540a74b
commit
0cc88f266d
@ -14,14 +14,14 @@ FreeBSD:UFS)
|
||||
userflags="UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE"
|
||||
systemflags="SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK"
|
||||
|
||||
echo "1..247"
|
||||
echo "1..780"
|
||||
;;
|
||||
FreeBSD:ZFS)
|
||||
allflags="UF_NODUMP,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK"
|
||||
userflags="UF_NODUMP"
|
||||
systemflags="SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK"
|
||||
|
||||
echo "1..167"
|
||||
echo "1..520"
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
@ -36,41 +36,39 @@ expect 0 mkdir ${n2} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n2}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect none stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${allflags}
|
||||
expect ${allflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${userflags}
|
||||
expect ${userflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${systemflags}
|
||||
expect ${systemflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} none
|
||||
expect none stat ${n0} flags
|
||||
expect 0 unlink ${n0}
|
||||
for type in regular dir fifo block char socket; do
|
||||
create_file ${type} ${n0} 0 0
|
||||
expect none stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${allflags}
|
||||
expect ${allflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${userflags}
|
||||
expect ${userflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${systemflags}
|
||||
expect ${systemflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} none
|
||||
expect none stat ${n0} flags
|
||||
if [ "${type}" = "dir" ]; then
|
||||
expect 0 rmdir ${n0}
|
||||
else
|
||||
expect 0 unlink ${n0}
|
||||
fi
|
||||
|
||||
expect 0 mkdir ${n0} 0644
|
||||
expect none stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${allflags}
|
||||
expect ${allflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${userflags}
|
||||
expect ${userflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${systemflags}
|
||||
expect ${systemflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} none
|
||||
expect none stat ${n0} flags
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
expect none stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${allflags}
|
||||
expect ${allflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${userflags}
|
||||
expect ${userflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${systemflags}
|
||||
expect ${systemflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} none
|
||||
expect none stat ${n0} flags
|
||||
expect 0 unlink ${n0}
|
||||
create_file ${type} ${n0} 0 0
|
||||
expect none stat ${n0} flags
|
||||
expect 0 lchflags ${n0} ${allflags}
|
||||
expect ${allflags} stat ${n0} flags
|
||||
expect 0 lchflags ${n0} ${userflags}
|
||||
expect ${userflags} stat ${n0} flags
|
||||
expect 0 lchflags ${n0} ${systemflags}
|
||||
expect ${systemflags} stat ${n0} flags
|
||||
expect 0 lchflags ${n0} none
|
||||
expect none stat ${n0} flags
|
||||
if [ "${type}" = "dir" ]; then
|
||||
expect 0 rmdir ${n0}
|
||||
else
|
||||
expect 0 unlink ${n0}
|
||||
fi
|
||||
done
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
@ -111,86 +109,70 @@ expect 0 unlink ${n1}
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# successful chflags(2) updates ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
done
|
||||
expect 0 unlink ${n0}
|
||||
for type in regular dir fifo block char socket symlink; do
|
||||
if [ "${type}" != "symlink" ]; then
|
||||
create_file ${type} ${n0} 0 0
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
done
|
||||
if [ "${type}" = "dir" ]; then
|
||||
expect 0 rmdir ${n0}
|
||||
else
|
||||
expect 0 unlink ${n0}
|
||||
fi
|
||||
fi
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
create_file ${type} ${n0} 0 0
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 lchflags ${n0} ${flag}
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
done
|
||||
if [ "${type}" = "dir" ]; then
|
||||
expect 0 rmdir ${n0}
|
||||
else
|
||||
expect 0 unlink ${n0}
|
||||
fi
|
||||
done
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 lchflags ${n0} ${flag}
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# unsuccessful chflags(2) does not update ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
done
|
||||
expect 0 unlink ${n0}
|
||||
for type in regular dir fifo block char socket symlink; do
|
||||
if [ "${type}" != "symlink" ]; then
|
||||
create_file ${type} ${n0} 0 0
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
done
|
||||
if [ "${type}" = "dir" ]; then
|
||||
expect 0 rmdir ${n0}
|
||||
else
|
||||
expect 0 unlink ${n0}
|
||||
fi
|
||||
fi
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
create_file ${type} ${n0} 0 0
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 lchflags ${n0} ${flag}
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
done
|
||||
if [ "${type}" = "dir" ]; then
|
||||
expect 0 rmdir ${n0}
|
||||
else
|
||||
expect 0 unlink ${n0}
|
||||
fi
|
||||
done
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 chflags ${n0} ${flag}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 lchflags ${n0} ${flag}
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n2}
|
||||
|
@ -8,7 +8,7 @@ dir=`dirname $0`
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..62"
|
||||
echo "1..210"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -18,45 +18,37 @@ expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
|
||||
expect 0 create ${n1} 0644
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
done
|
||||
expect 0 unlink ${n1}
|
||||
for type in regular dir fifo block char socket symlink; do
|
||||
if [ "${type}" != "symlink" ]; then
|
||||
create_file ${type} ${n1} 0 0
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
done
|
||||
if [ "${type}" = "dir" ]; then
|
||||
expect 0 rmdir ${n1}
|
||||
else
|
||||
expect 0 unlink ${n1}
|
||||
fi
|
||||
fi
|
||||
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
create_file ${type} ${n1} 0 0
|
||||
expect 0 lchown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect EPERM -u 65533 -g 65533 lchflags ${n1} ${flag}
|
||||
expect none lstat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 lchflags ${n1} ${flag}
|
||||
expect none lstat ${n1} flags
|
||||
done
|
||||
if [ "${type}" = "dir" ]; then
|
||||
expect 0 rmdir ${n1}
|
||||
else
|
||||
expect 0 unlink ${n1}
|
||||
fi
|
||||
done
|
||||
expect 0 rmdir ${n1}
|
||||
|
||||
expect 0 mkfifo ${n1} 0644
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag}
|
||||
expect none stat ${n1} flags
|
||||
done
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 symlink ${n2} ${n1}
|
||||
expect 0 lchown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect EPERM -u 65533 -g 65533 lchflags ${n1} ${flag}
|
||||
expect none lstat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 lchflags ${n1} ${flag}
|
||||
expect none lstat ${n1} flags
|
||||
done
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n0}
|
||||
|
@ -8,7 +8,7 @@ dir=`dirname $0`
|
||||
|
||||
require chflags_SF_SNAPSHOT
|
||||
|
||||
echo "1..46"
|
||||
echo "1..158"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -18,53 +18,41 @@ expect 0 mkdir ${n0} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n0}
|
||||
|
||||
expect 0 create ${n1} 0644
|
||||
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
|
||||
expect 0 unlink ${n1}
|
||||
for type in regular dir fifo block char socket symlink; do
|
||||
if [ "${type}" != "symlink" ]; then
|
||||
create_file ${type} ${n1} 0 0
|
||||
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
|
||||
|
||||
expect 0 mkdir ${n1} 0644
|
||||
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
|
||||
expect 0 rmdir ${n1}
|
||||
|
||||
expect 0 mkfifo ${n1} 0644
|
||||
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
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 symlink ${n2} ${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
|
||||
expect 0 unlink ${n1}
|
||||
create_file ${type} ${n1} 0 0
|
||||
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}
|
||||
|
@ -7,9 +7,9 @@ dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
if supported lchmod; then
|
||||
echo "1..186"
|
||||
echo "1..264"
|
||||
else
|
||||
echo "1..171"
|
||||
echo "1..249"
|
||||
fi
|
||||
|
||||
n0=`namegen`
|
||||
@ -21,28 +21,49 @@ cdir=`pwd`
|
||||
cd ${n2}
|
||||
|
||||
# super-user can always modify ownership
|
||||
# 2
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 123 456
|
||||
expect 123,456 lstat ${n0} uid,gid
|
||||
expect 0 chown ${n0} 0 0
|
||||
expect 0,0 lstat ${n0} uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
# 8
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
expect 0 chown ${n0} 123 456
|
||||
expect 123,456 lstat ${n0} uid,gid
|
||||
expect 0 chown ${n0} 0 0
|
||||
expect 0,0 lstat ${n0} uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
# 14
|
||||
|
||||
expect 0 mknod ${n0} b 0644 1 2
|
||||
expect 0 chown ${n0} 123 456
|
||||
expect 123,456 lstat ${n0} uid,gid
|
||||
expect 0 chown ${n0} 0 0
|
||||
expect 0,0 lstat ${n0} uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} c 0644 1 2
|
||||
expect 0 chown ${n0} 123 456
|
||||
expect 123,456 lstat ${n0} uid,gid
|
||||
expect 0 chown ${n0} 0 0
|
||||
expect 0,0 lstat ${n0} uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 bind ${n0}
|
||||
expect 0 chown ${n0} 123 456
|
||||
expect 123,456 lstat ${n0} uid,gid
|
||||
expect 0 chown ${n0} 0 0
|
||||
expect 0,0 lstat ${n0} uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 chown ${n0} 123 456
|
||||
expect 123,456 lstat ${n0} uid,gid
|
||||
expect 0 chown ${n0} 0 0
|
||||
expect 0,0 lstat ${n0} uid,gid
|
||||
expect 0 rmdir ${n0}
|
||||
# 20
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect 0 chown ${n1} 123 456
|
||||
@ -57,7 +78,7 @@ expect 0 unlink ${n1}
|
||||
|
||||
# non-super-user can modify file group if he is owner of a file and
|
||||
# gid he is setting is in his groups list.
|
||||
# 31
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 65534,65533 lstat ${n0} uid,gid
|
||||
@ -69,14 +90,14 @@ expect 0 unlink ${n0}
|
||||
|
||||
# chown(2) return 0 if user is not owner of a file, but chown(2) is called
|
||||
# with both uid and gid equal to -1.
|
||||
# 39
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 0 -u 65532 -g 65531 -- chown ${n0} -1 -1
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# when super-user calls chown(2), set-uid and set-gid bits may be removed.
|
||||
# 43
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 0 chmod ${n0} 06555
|
||||
@ -84,7 +105,7 @@ expect 06555 lstat ${n0} mode
|
||||
expect 0 chown ${n0} 65532 65531
|
||||
expect "06555|0555" lstat ${n0} mode
|
||||
expect 0 unlink ${n0}
|
||||
# 50
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 0 0
|
||||
expect 0 chmod ${n0} 06555
|
||||
@ -92,7 +113,7 @@ expect 06555 lstat ${n0} mode
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect "06555|0555" lstat ${n0} mode
|
||||
expect 0 unlink ${n0}
|
||||
# 57
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 0 chmod ${n0} 06555
|
||||
@ -103,7 +124,7 @@ expect 0 unlink ${n0}
|
||||
|
||||
# when non-super-user calls chown(2) successfully, set-uid and set-gid bits may
|
||||
# be removed, except when both uid and gid are equal to -1.
|
||||
# 64
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 0 chmod ${n0} 06555
|
||||
@ -119,7 +140,7 @@ expect 06555 lstat ${n0} mode
|
||||
expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 -1
|
||||
expect "06555,65534,65533|0555,65534,65533" lstat ${n0} mode,uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
# 79
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 0 chmod ${n0} 06555
|
||||
@ -135,7 +156,7 @@ expect 06555 lstat ${n0} mode
|
||||
expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 -1
|
||||
expect 06555,65534,65533 lstat ${n0} mode,uid,gid
|
||||
expect 0 rmdir ${n0}
|
||||
# 94
|
||||
|
||||
if supported lchmod; then
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
expect 0 lchown ${n0} 65534 65533
|
||||
@ -155,7 +176,7 @@ if supported lchmod; then
|
||||
fi
|
||||
|
||||
# successfull chown(2) call (except uid and gid equal to -1) updates ctime.
|
||||
# 109
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
@ -164,7 +185,7 @@ expect 65534,65533 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 114
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
@ -173,7 +194,7 @@ expect 65534,65533 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 rmdir ${n0}
|
||||
# 119
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
@ -182,7 +203,34 @@ expect 65534,65533 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 124
|
||||
|
||||
expect 0 mknod ${n0} b 0644 1 2
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 65534,65533 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} c 0644 1 2
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 65534,65533 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 bind ${n0}
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 65534,65533 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
@ -191,7 +239,7 @@ expect 65534,65533 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 129
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
@ -201,7 +249,7 @@ expect 65534,65532 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 135
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
@ -211,7 +259,7 @@ expect 65534,65532 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 rmdir ${n0}
|
||||
# 141
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
@ -222,7 +270,40 @@ expect 65534,65532 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 148
|
||||
|
||||
expect 0 mknod ${n0} b 0644 1 2
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 0 -u 65534 -g 65532 chown ${n0} 65534 65532
|
||||
expect 65534,65532 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} c 0644 1 2
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 0 -u 65534 -g 65532 chown ${n0} 65534 65532
|
||||
expect 65534,65532 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 bind ${n0}
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chown ${n0} 65534 65533
|
||||
expect 0 -u 65534 -g 65532 chown ${n0} 65534 65532
|
||||
expect 65534,65532 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
expect 0 lchown ${n0} 65534 65533
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
@ -232,7 +313,7 @@ expect 65534,65532 lstat ${n0} uid,gid
|
||||
ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 154
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
@ -241,7 +322,7 @@ ctime2=`${fstest} stat ${n0} ctime`
|
||||
todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated."
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 158
|
||||
|
||||
expect 0 mkdir ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
@ -250,7 +331,7 @@ ctime2=`${fstest} stat ${n0} ctime`
|
||||
todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated."
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 rmdir ${n0}
|
||||
# 162
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
@ -259,7 +340,34 @@ ctime2=`${fstest} stat ${n0} ctime`
|
||||
todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated."
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 166
|
||||
|
||||
expect 0 mknod ${n0} b 0644 1 2
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 -- chown ${n0} -1 -1
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated."
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} c 0644 1 2
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 -- chown ${n0} -1 -1
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated."
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 bind ${n0}
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 -- chown ${n0} -1 -1
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated."
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
@ -270,7 +378,7 @@ test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# unsuccessful chown(2) does not update ctime.
|
||||
# 170
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
@ -278,7 +386,7 @@ expect EPERM -u 65534 -- chown ${n0} 65534 -1
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 174
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
@ -286,7 +394,7 @@ expect EPERM -u 65534 -g 65534 -- chown ${n0} -1 65534
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 rmdir ${n0}
|
||||
# 178
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
@ -294,7 +402,31 @@ expect EPERM -u 65534 -g 65534 chown ${n0} 65534 65534
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
# 182
|
||||
|
||||
expect 0 mknod ${n0} b 0644 1 2
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 -g 65534 chown ${n0} 65534 65534
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} c 0644 1 2
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 -g 65534 chown ${n0} 65534 65534
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 bind ${n0}
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 -g 65534 chown ${n0} 65534 65534
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
@ -303,6 +435,5 @@ ctime2=`${fstest} lstat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# 186
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n2}
|
||||
|
@ -6,7 +6,7 @@ desc="link creates hardlinks"
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..82"
|
||||
echo "1..217"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -17,135 +17,77 @@ expect 0 mkdir ${n3} 0755
|
||||
cdir=`pwd`
|
||||
cd ${n3}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect regular,0644,1 lstat ${n0} type,mode,nlink
|
||||
for type in regular fifo block char socket; do
|
||||
create_file ${type} ${n0} 0 0
|
||||
expect ${type},1 lstat ${n0} type,nlink
|
||||
|
||||
expect 0 link ${n0} ${n1}
|
||||
expect regular,0644,2 lstat ${n0} type,mode,nlink
|
||||
expect regular,0644,2 lstat ${n1} type,mode,nlink
|
||||
expect 0 link ${n0} ${n1}
|
||||
expect ${type},2 lstat ${n0} type,nlink
|
||||
expect ${type},2 lstat ${n1} type,nlink
|
||||
|
||||
expect 0 link ${n1} ${n2}
|
||||
expect regular,0644,3 lstat ${n0} type,mode,nlink
|
||||
expect regular,0644,3 lstat ${n1} type,mode,nlink
|
||||
expect regular,0644,3 lstat ${n2} type,mode,nlink
|
||||
expect 0 link ${n1} ${n2}
|
||||
expect ${type},3 lstat ${n0} type,nlink
|
||||
expect ${type},3 lstat ${n1} type,nlink
|
||||
expect ${type},3 lstat ${n2} type,nlink
|
||||
|
||||
expect 0 chmod ${n1} 0201
|
||||
expect 0 chown ${n1} 65534 65533
|
||||
expect 0 chmod ${n1} 0201
|
||||
expect 0 chown ${n1} 65534 65533
|
||||
|
||||
expect regular,0201,3,65534,65533 lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect regular,0201,3,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect regular,0201,3,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
|
||||
expect ${type},0201,3,65534,65533 lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect ${type},0201,3,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect ${type},0201,3,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect 0 unlink ${n0}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect regular,0201,2,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect regular,0201,2,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
|
||||
expect 0 unlink ${n0}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect ${type},0201,2,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect ${type},0201,2,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect 0 unlink ${n2}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect regular,0201,1,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
|
||||
expect 0 unlink ${n2}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect ${type},0201,1,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect 0 unlink ${n1}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect ENOENT lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
expect fifo,0644,1 lstat ${n0} type,mode,nlink
|
||||
|
||||
expect 0 link ${n0} ${n1}
|
||||
expect fifo,0644,2 lstat ${n0} type,mode,nlink
|
||||
expect fifo,0644,2 lstat ${n1} type,mode,nlink
|
||||
|
||||
expect 0 link ${n1} ${n2}
|
||||
expect fifo,0644,3 lstat ${n0} type,mode,nlink
|
||||
expect fifo,0644,3 lstat ${n1} type,mode,nlink
|
||||
expect fifo,0644,3 lstat ${n2} type,mode,nlink
|
||||
|
||||
expect 0 chmod ${n1} 0201
|
||||
expect 0 chown ${n1} 65534 65533
|
||||
|
||||
expect fifo,0201,3,65534,65533 lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect fifo,0201,3,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect fifo,0201,3,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect 0 unlink ${n0}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect fifo,0201,2,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect fifo,0201,2,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect 0 unlink ${n2}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect fifo,0201,1,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
|
||||
|
||||
expect 0 unlink ${n1}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect ENOENT lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
|
||||
expect 0 unlink ${n1}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
|
||||
expect ENOENT lstat ${n1} type,mode,nlink,uid,gid
|
||||
expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
|
||||
done
|
||||
|
||||
# successful link(2) updates ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
dctime1=`${fstest} stat . ctime`
|
||||
dmtime1=`${fstest} stat . mtime`
|
||||
sleep 1
|
||||
expect 0 link ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
dctime2=`${fstest} stat . ctime`
|
||||
test_check $dctime1 -lt $dctime2
|
||||
dmtime2=`${fstest} stat . mtime`
|
||||
test_check $dctime1 -lt $dmtime2
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
dctime1=`${fstest} stat . ctime`
|
||||
dmtime1=`${fstest} stat . mtime`
|
||||
sleep 1
|
||||
expect 0 link ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
dctime2=`${fstest} stat . ctime`
|
||||
test_check $dctime1 -lt $dctime2
|
||||
dmtime2=`${fstest} stat . mtime`
|
||||
test_check $dctime1 -lt $dmtime2
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
for type in regular fifo block char socket; do
|
||||
create_file ${type} ${n0} 0 0
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
dctime1=`${fstest} stat . ctime`
|
||||
dmtime1=`${fstest} stat . mtime`
|
||||
sleep 1
|
||||
expect 0 link ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
dctime2=`${fstest} stat . ctime`
|
||||
test_check $dctime1 -lt $dctime2
|
||||
dmtime2=`${fstest} stat . mtime`
|
||||
test_check $dctime1 -lt $dmtime2
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
done
|
||||
|
||||
# unsuccessful link(2) does not update ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
expect 0 -- chown ${n0} 65534 -1
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
dctime1=`${fstest} stat . ctime`
|
||||
dmtime1=`${fstest} stat . mtime`
|
||||
sleep 1
|
||||
expect EACCES -u 65534 link ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
dctime2=`${fstest} stat . ctime`
|
||||
test_check $dctime1 -eq $dctime2
|
||||
dmtime2=`${fstest} stat . mtime`
|
||||
test_check $dctime1 -eq $dmtime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
expect 0 -- chown ${n0} 65534 -1
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
dctime1=`${fstest} stat . ctime`
|
||||
dmtime1=`${fstest} stat . mtime`
|
||||
sleep 1
|
||||
expect EACCES -u 65534 link ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
dctime2=`${fstest} stat . ctime`
|
||||
test_check $dctime1 -eq $dctime2
|
||||
dmtime2=`${fstest} stat . mtime`
|
||||
test_check $dctime1 -eq $dmtime2
|
||||
expect 0 unlink ${n0}
|
||||
for type in regular fifo block char socket; do
|
||||
create_file ${type} ${n0} 0 0
|
||||
expect 0 -- chown ${n0} 65534 -1
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
dctime1=`${fstest} stat . ctime`
|
||||
dmtime1=`${fstest} stat . mtime`
|
||||
sleep 1
|
||||
expect EACCES -u 65534 link ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
dctime2=`${fstest} stat . ctime`
|
||||
test_check $dctime1 -eq $dctime2
|
||||
dmtime2=`${fstest} stat . mtime`
|
||||
test_check $dctime1 -eq $dmtime2
|
||||
expect 0 unlink ${n0}
|
||||
done
|
||||
|
||||
cd ${cdir}
|
||||
expect 0 rmdir ${n3}
|
||||
|
@ -6,7 +6,7 @@ desc="rename returns EACCES or EPERM if the directory containing 'from' is marke
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..56"
|
||||
echo "1..2353"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -19,73 +19,170 @@ cdir=`pwd`
|
||||
cd ${n4}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 chown ${n0} 65534 65534
|
||||
expect 0 chmod ${n0} 01777
|
||||
expect 0 chown ${n0} 65534 65534
|
||||
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
|
||||
# User owns both: the sticky directory and the file to be renamed.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User owns the file to be renamed, but doesn't own the sticky directory.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65533 -g 65533 create ${n0}/${n2} 0644
|
||||
expect 0 -u 65533 -g 65533 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User owns the sticky directory, but doesn't own the file to be renamed.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65533 -g 65533 create ${n0}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User doesn't own the sticky directory nor the file to be renamed.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
expect "EACCES|EPERM" -u 65533 -g 65533 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
for type in regular fifo block char socket symlink; do
|
||||
# User owns both: the source sticky directory and the source file.
|
||||
expect 0 chown ${n0} 65534 65534
|
||||
create_file ${type} ${n0}/${n2} 65534 65534
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
# User owns both: the sticky directory and the fifo to be renamed.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User owns the fifo to be renamed, but doesn't own the sticky directory.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65533 -g 65533 mkfifo ${n0}/${n2} 0644
|
||||
expect 0 -u 65533 -g 65533 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User owns the sticky directory, but doesn't own the fifo to be renamed.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65533 -g 65533 mkfifo ${n0}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User doesn't own the sticky directory nor the fifo to be renamed.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644
|
||||
expect "EACCES|EPERM" -u 65533 -g 65533 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
for type in none regular fifo block char socket symlink; do
|
||||
create_file ${type} ${n1}/${n3} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode},65534,65534 lstat ${n1}/${n3} inode,uid,gid
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
done
|
||||
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
|
||||
# User owns the source sticky directory, but doesn't own the source file.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n0} 65534 65534
|
||||
create_file ${type} ${n0}/${n2} ${id} ${id}
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
for type in none regular fifo block char socket symlink; do
|
||||
create_file ${type} ${n1}/${n3} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode},${id},${id} lstat ${n1}/${n3} inode,uid,gid
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
done
|
||||
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
done
|
||||
|
||||
# User owns the source file, but doesn't own the source sticky directory.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n0} ${id} ${id}
|
||||
create_file ${type} ${n0}/${n2} 65534 65534
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
for type in none regular fifo block char socket symlink; do
|
||||
create_file ${type} ${n1}/${n3} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode},65534,65534 lstat ${n1}/${n3} inode,uid,gid
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
done
|
||||
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
done
|
||||
|
||||
# User doesn't own the source sticky directory nor the source file.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n0} ${id} ${id}
|
||||
create_file ${type} ${n0}/${n2} ${id} ${id}
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
for type in none regular fifo block char socket symlink; do
|
||||
create_file ${type} ${n1}/${n3} 65534 65534
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode},${id},${id} lstat ${n0}/${n2} inode,uid,gid
|
||||
if [ "${type}" != "none" ]; then
|
||||
expect 65534,65534 lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
fi
|
||||
done
|
||||
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
done
|
||||
done
|
||||
|
||||
# User owns both: the source sticky directory and the source directory.
|
||||
expect 0 chown ${n0} 65534 65534
|
||||
create_file dir ${n0}/${n2} 65534 65534
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
# User owns both: the sticky directory and the symlink to be renamed.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n0}/${n2}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User owns the symlink to be renamed, but doesn't own the sticky directory.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65533 -g 65533 symlink test ${n0}/${n2}
|
||||
expect 0 -u 65533 -g 65533 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User owns the sticky directory, but doesn't own the symlink to be renamed.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65533 -g 65533 symlink test ${n0}/${n2}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode},65534,65534 lstat ${n1}/${n3} inode,uid,gid
|
||||
expect 0 rename ${n1}/${n3} ${n0}/${n2}
|
||||
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User doesn't own the sticky directory nor the symlink to be renamed.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n0}/${n2}
|
||||
expect "EACCES|EPERM" -u 65533 -g 65533 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode},65534,65534 lstat ${n1}/${n3} inode,uid,gid
|
||||
expect 0 rmdir ${n1}/${n3}
|
||||
|
||||
# User owns the source sticky directory, but doesn't own the source directory.
|
||||
# This fails when changing parent directory, because this will modify
|
||||
# source directory inode (the .. link in it), but we can still rename it
|
||||
# without changing its parent directory.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n0} 65534 65534
|
||||
create_file dir ${n0}/${n2} ${id} ${id}
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode},${id},${id} lstat ${n0}/${n2} inode,uid,gid
|
||||
expect ENOENT lstat ${n1}/${n3} type
|
||||
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n0}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode},${id},${id} lstat ${n0}/${n3} inode,uid,gid
|
||||
expect 0 rename ${n0}/${n3} ${n0}/${n2}
|
||||
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode},${id},${id} lstat ${n0}/${n2} inode,uid,gid
|
||||
expect dir,${id},${id} lstat ${n0}/${n2} type,uid,gid
|
||||
expect 0 rmdir ${n1}/${n3}
|
||||
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n0}/${n3} 0755
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n0}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode},${id},${id} lstat ${n0}/${n3} inode,uid,gid
|
||||
expect 0 rmdir ${n0}/${n3}
|
||||
done
|
||||
|
||||
# User owns the source directory, but doesn't own the source sticky directory.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n0} ${id} ${id}
|
||||
create_file dir ${n0}/${n2} 65534 65534
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode},65534,65534 lstat ${n1}/${n3} inode,uid,gid
|
||||
expect 0 rename ${n1}/${n3} ${n0}/${n2}
|
||||
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode},65534,65534 lstat ${n1}/${n3} inode,uid,gid
|
||||
expect 0 rmdir ${n1}/${n3}
|
||||
done
|
||||
|
||||
# User doesn't own the source sticky directory nor the source directory.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n0} ${id} ${id}
|
||||
create_file dir ${n0}/${n2} ${id} ${id}
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode},${id},${id} lstat ${n0}/${n2} inode,uid,gid
|
||||
expect ENOENT lstat ${n1}/${n3} type
|
||||
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode},${id},${id} lstat ${n0}/${n2} inode,uid,gid
|
||||
expect dir,65534,65534 lstat ${n1}/${n3} type,uid,gid
|
||||
expect 0 rmdir ${n0}/${n2}
|
||||
expect 0 rmdir ${n1}/${n3}
|
||||
done
|
||||
|
||||
expect 0 rmdir ${n1}
|
||||
expect 0 rmdir ${n0}
|
||||
|
@ -6,7 +6,7 @@ desc="rename returns EACCES or EPERM if the file pointed at by the 'to' argument
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..1903"
|
||||
echo "1..2099"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -24,144 +24,39 @@ expect 0 chown ${n0} 65534 65534
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chmod ${n1} 01777
|
||||
|
||||
create_file() {
|
||||
case "${1}" in
|
||||
regular)
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
;;
|
||||
fifo)
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644
|
||||
;;
|
||||
block)
|
||||
expect 0 mknod ${n0}/${n2} b 0644 1 2
|
||||
expect 0 chown ${n0}/${n2} 65534 65534
|
||||
;;
|
||||
char)
|
||||
expect 0 mknod ${n0}/${n2} c 0644 1 2
|
||||
expect 0 chown ${n0}/${n2} 65534 65534
|
||||
;;
|
||||
socket)
|
||||
expect 0 -u 65534 -g 65534 bind ${n0}/${n2}
|
||||
;;
|
||||
symlink)
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n0}/${n2}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
for type in regular fifo block char socket symlink; do
|
||||
# User owns both: the sticky directory and the destination file.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
create_file ${type}
|
||||
create_file ${type} ${n0}/${n2} 65534 65534
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 mknod ${n1}/${n3} b 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 mknod ${n1}/${n3} c 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u 65534 -g 65534 bind ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
for type in regular fifo block char socket symlink; do
|
||||
create_file ${type} ${n1}/${n3} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
done
|
||||
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
|
||||
# User owns the sticky directory, but doesn't own the destination file.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
create_file ${type}
|
||||
create_file ${type} ${n0}/${n2} 65534 65534
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect 0 -u ${id} -g ${id} create ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u ${id} -g ${id} mkfifo ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 mknod ${n1}/${n3} b 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} ${id} ${id}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 mknod ${n1}/${n3} c 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} ${id} ${id}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u ${id} -g ${id} bind ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u ${id} -g ${id} symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
for type in regular fifo block char socket symlink; do
|
||||
create_file ${type} ${n1}/${n3} ${id} ${id}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
done
|
||||
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
done
|
||||
@ -169,58 +64,18 @@ for type in regular fifo block char socket symlink; do
|
||||
# User owns the destination file, but doesn't own the sticky directory.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n1} ${id} ${id}
|
||||
create_file ${type}
|
||||
create_file ${type} ${n0}/${n2} 65534 65534
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 mknod ${n1}/${n3} b 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 mknod ${n1}/${n3} c 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u 65534 -g 65534 bind ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
for type in regular fifo block char socket symlink; do
|
||||
create_file ${type} ${n1}/${n3} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
done
|
||||
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
done
|
||||
@ -228,46 +83,16 @@ for type in regular fifo block char socket symlink; do
|
||||
# User doesn't own the sticky directory nor the destination file.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n1} ${id} ${id}
|
||||
create_file ${type}
|
||||
create_file ${type} ${n0}/${n2} 65534 65534
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect 0 -u ${id} -g ${id} create ${n1}/${n3} 0644
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
|
||||
expect 0 -u ${id} -g ${id} mkfifo ${n1}/${n3} 0644
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
|
||||
expect 0 mknod ${n1}/${n3} b 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} ${id} ${id}
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
|
||||
expect 0 mknod ${n1}/${n3} c 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} ${id} ${id}
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
|
||||
expect 0 -u ${id} -g ${id} bind ${n1}/${n3}
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
|
||||
expect 0 -u ${id} -g ${id} symlink test ${n1}/${n3}
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
for type in regular fifo block char socket symlink; do
|
||||
create_file ${type} ${n1}/${n3} ${id} ${id}
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
done
|
||||
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
done
|
||||
|
@ -37,7 +37,7 @@ expect ENOENT rmdir ${n3}/${n1}
|
||||
|
||||
# Check that write permission on containing directory (${n2}) is enough
|
||||
# to move file (${n0}) from that directory.
|
||||
expect 0 create ${n2}/${n0} 0755
|
||||
expect 0 create ${n2}/${n0} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1}
|
||||
|
||||
expect 0 unlink ${n3}/${n1}
|
||||
|
Loading…
Reference in New Issue
Block a user