4 desc
="rename returns EACCES or EPERM if the directory containing 'from' is marked sticky, and neither the containing directory nor 'from' are owned by the effective user ID"
17 expect
0 mkdir
${n4} 0755
21 expect
0 mkdir
${n0} 0755
22 expect
0 chown
${n0} 65534 65534
23 expect
0 chmod ${n0} 01777
25 expect
0 mkdir
${n1} 0755
27 # User owns both: the sticky directory and the file to be renamed.
28 expect
0 chown
${n1} 65534 65534
29 expect
0 -u 65534 -g 65534 create
${n0}/${n2} 0644
30 expect
0 -u 65534 -g 65534 rename
${n0}/${n2} ${n1}/${n3}
31 expect
0 unlink
${n1}/${n3}
32 # User owns the file to be renamed, but doesn't own the sticky directory.
33 expect
0 chown
${n1} 65533 65533
34 expect
0 -u 65533 -g 65533 create
${n0}/${n2} 0644
35 expect
0 -u 65533 -g 65533 rename
${n0}/${n2} ${n1}/${n3}
36 expect
0 unlink
${n1}/${n3}
37 # User owns the sticky directory, but doesn't own the file to be renamed.
38 expect
0 chown
${n1} 65534 65534
39 expect
0 -u 65533 -g 65533 create
${n0}/${n2} 0644
40 expect
0 -u 65534 -g 65534 rename
${n0}/${n2} ${n1}/${n3}
41 expect
0 unlink
${n1}/${n3}
42 # User doesn't own the sticky directory nor the file to be renamed.
43 expect
0 chown
${n1} 65533 65533
44 expect
0 -u 65534 -g 65534 create
${n0}/${n2} 0644
45 expect
"EACCES|EPERM" -u 65533 -g 65533 rename
${n0}/${n2} ${n1}/${n3}
46 expect
0 unlink
${n0}/${n2}
48 # User owns both: the sticky directory and the fifo to be renamed.
49 expect
0 chown
${n1} 65534 65534
50 expect
0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644
51 expect
0 -u 65534 -g 65534 rename
${n0}/${n2} ${n1}/${n3}
52 expect
0 unlink
${n1}/${n3}
53 # User owns the fifo to be renamed, but doesn't own the sticky directory.
54 expect
0 chown
${n1} 65533 65533
55 expect
0 -u 65533 -g 65533 mkfifo ${n0}/${n2} 0644
56 expect
0 -u 65533 -g 65533 rename
${n0}/${n2} ${n1}/${n3}
57 expect
0 unlink
${n1}/${n3}
58 # User owns the sticky directory, but doesn't own the fifo to be renamed.
59 expect
0 chown
${n1} 65534 65534
60 expect
0 -u 65533 -g 65533 mkfifo ${n0}/${n2} 0644
61 expect
0 -u 65534 -g 65534 rename
${n0}/${n2} ${n1}/${n3}
62 expect
0 unlink
${n1}/${n3}
63 # User doesn't own the sticky directory nor the fifo to be renamed.
64 expect
0 chown
${n1} 65533 65533
65 expect
0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644
66 expect
"EACCES|EPERM" -u 65533 -g 65533 rename
${n0}/${n2} ${n1}/${n3}
67 expect
0 unlink
${n0}/${n2}
69 # User owns both: the sticky directory and the symlink to be renamed.
70 expect
0 chown
${n1} 65534 65534
71 expect
0 -u 65534 -g 65534 symlink
test ${n0}/${n2}
72 expect
0 -u 65534 -g 65534 rename
${n0}/${n2} ${n1}/${n3}
73 expect
0 unlink
${n1}/${n3}
74 # User owns the symlink to be renamed, but doesn't own the sticky directory.
75 expect
0 chown
${n1} 65533 65533
76 expect
0 -u 65533 -g 65533 symlink
test ${n0}/${n2}
77 expect
0 -u 65533 -g 65533 rename
${n0}/${n2} ${n1}/${n3}
78 expect
0 unlink
${n1}/${n3}
79 # User owns the sticky directory, but doesn't own the symlink to be renamed.
80 expect
0 chown
${n1} 65534 65534
81 expect
0 -u 65533 -g 65533 symlink
test ${n0}/${n2}
82 expect
0 -u 65534 -g 65534 rename
${n0}/${n2} ${n1}/${n3}
83 expect
0 unlink
${n1}/${n3}
84 # User doesn't own the sticky directory nor the symlink to be renamed.
85 expect
0 chown
${n1} 65533 65533
86 expect
0 -u 65534 -g 65534 symlink
test ${n0}/${n2}
87 expect
"EACCES|EPERM" -u 65533 -g 65533 rename
${n0}/${n2} ${n1}/${n3}
88 expect
0 unlink
${n0}/${n2}