1#!/bin/sh
2# $FreeBSD: src/tools/regression/fstest/tests/chown/07.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
3
4desc="chown returns EPERM if the operation would change the ownership, but the effective user ID is not the super-user and the process is not an owner of the file"
5
6n0=`namegen`
7n1=`namegen`
8n2=`namegen`
9
10expect 0 mkdir ${n0} 0755
11cdir=`pwd`
12cd ${n0}
13expect 0 mkdir ${n1} 0755
14expect 0 chown ${n1} 65534 65534
15expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644
16expect EPERM -u 65534 -g 65534 chown ${n1}/${n2} 65533 65533
17expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65534 65534
18expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65533 65533
19expect EPERM -u 65534 -g 65534 chown ${n1}/${n2} -1 65533
20expect 0 unlink ${n1}/${n2}
21expect 0 rmdir ${n1}
22cd ${cdir}
23expect 0 rmdir ${n0}
24