4 desc="unlink returns EACCES or EPERM if the directory containing the file is marked sticky, and neither the containing directory nor the file to be removed are owned by the effective user ID"
15 expect 0 mkdir ${n2} 0755
19 expect 0 mkdir ${n0} 0755
20 expect 0 chmod ${n0} 01777
21 expect 0 chown ${n0} 65534 65534
23 for type in regular fifo block char socket symlink; do
24 # User owns both: the sticky directory and the file.
25 expect 0 chown ${n0} 65534 65534
26 create_file ${type} ${n0}/${n1} 65534 65534
27 expect ${type},65534,65534 lstat ${n0}/${n1} type,uid,gid
28 expect 0 -u 65534 -g 65534 unlink ${n0}/${n1}
29 expect ENOENT lstat ${n0}/${n1} type
31 # User owns the sticky directory, but doesn't own the file.
33 expect 0 chown ${n0} 65534 65534
34 create_file ${type} ${n0}/${n1} ${id} ${id}
35 expect ${type},${id},${id} lstat ${n0}/${n1} type,uid,gid
36 expect 0 -u 65534 -g 65534 unlink ${n0}/${n1}
37 expect ENOENT lstat ${n0}/${n1} type
40 # User owns the file, but doesn't own the sticky directory.
42 expect 0 chown ${n0} ${id} ${id}
43 create_file ${type} ${n0}/${n1} 65534 65534
44 expect ${type},65534,65534 lstat ${n0}/${n1} type,uid,gid
45 expect 0 -u 65534 -g 65534 unlink ${n0}/${n1}
46 expect ENOENT lstat ${n0}/${n1} type
49 # User doesn't own the sticky directory nor the file.
51 expect 0 chown ${n0} ${id} ${id}
52 create_file ${type} ${n0}/${n1} ${id} ${id}
53 expect ${type},${id},${id} lstat ${n0}/${n1} type,uid,gid
54 expect "EACCES|EPERM" -u 65534 -g 65534 unlink ${n0}/${n1}
55 expect ${type},${id},${id} lstat ${n0}/${n1} type,uid,gid
56 expect 0 unlink ${n0}/${n1}