Blame test/root/setfacl.test

rpm-build 0a0c83
Setfacl utility tests. Run these tests on a filesystem with ACL support.
rpm-build 0a0c83
rpm-build 0a0c83
Cry immediately if we are not running as root.
rpm-build 0a0c83
rpm-build 0a0c83
	$ require_root
rpm-build 0a0c83
rpm-build 0a0c83
 	$ mkdir d
rpm-build 0a0c83
	$ chown bin:bin d
rpm-build 0a0c83
	$ cd d
rpm-build 0a0c83
rpm-build 0a0c83
	$ su bin
rpm-build 0a0c83
	$ sg bin
rpm-build 0a0c83
	$ umask 027
rpm-build 0a0c83
	$ touch g
rpm-build 0a0c83
	$ ls -dl g | awk '{print $1}' | sed 's/\\.//g'
rpm-build 0a0c83
	> -rw-r-----
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl -m m:- g
rpm-build 0a0c83
	$ ls -dl g | awk '{print $1}'
rpm-build 0a0c83
	> -rw-------+
rpm-build 0a0c83
rpm-build 0a0c83
	$ getfacl g
rpm-build 0a0c83
	> # file: g
rpm-build 0a0c83
	> # owner: bin
rpm-build 0a0c83
	> # group: bin
rpm-build 0a0c83
	> user::rw-
rpm-build 0a0c83
	> group::r--	#effective:---
rpm-build 0a0c83
	> mask::---
rpm-build 0a0c83
	> other::---
rpm-build 0a0c83
	>
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl -x m g
rpm-build 0a0c83
	$ getfacl g
rpm-build 0a0c83
	> # file: g
rpm-build 0a0c83
	> # owner: bin
rpm-build 0a0c83
	> # group: bin
rpm-build 0a0c83
	> user::rw-
rpm-build 0a0c83
	> group::r--
rpm-build 0a0c83
	> other::---
rpm-build 0a0c83
	>
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl -m u:daemon:rw g
rpm-build 0a0c83
	$ getfacl g
rpm-build 0a0c83
	> # file: g
rpm-build 0a0c83
	> # owner: bin
rpm-build 0a0c83
	> # group: bin
rpm-build 0a0c83
	> user::rw-
rpm-build 0a0c83
	> user:daemon:rw-
rpm-build 0a0c83
	> group::r--
rpm-build 0a0c83
	> mask::rw-
rpm-build 0a0c83
	> other::---
rpm-build 0a0c83
	>
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl -m u::rwx,g::r-x,o:- g
rpm-build 0a0c83
	$ getfacl g
rpm-build 0a0c83
	> # file: g
rpm-build 0a0c83
	> # owner: bin
rpm-build 0a0c83
	> # group: bin
rpm-build 0a0c83
	> user::rwx
rpm-build 0a0c83
	> user:daemon:rw-
rpm-build 0a0c83
	> group::r-x
rpm-build 0a0c83
	> mask::rwx
rpm-build 0a0c83
	> other::---
rpm-build 0a0c83
	>
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl -m u::rwx,g::r-x,o:-,m:- g
rpm-build 0a0c83
	$ getfacl g
rpm-build 0a0c83
	> # file: g
rpm-build 0a0c83
	> # owner: bin
rpm-build 0a0c83
	> # group: bin
rpm-build 0a0c83
	> user::rwx
rpm-build 0a0c83
	> user:daemon:rw-	#effective:---
rpm-build 0a0c83
	> group::r-x	#effective:---
rpm-build 0a0c83
	> mask::---
rpm-build 0a0c83
	> other::---
rpm-build 0a0c83
	>
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl -m u::rwx,g::r-x,o:-,u:root:-,m:- g
rpm-build 0a0c83
	$ getfacl g
rpm-build 0a0c83
	> # file: g
rpm-build 0a0c83
	> # owner: bin
rpm-build 0a0c83
	> # group: bin
rpm-build 0a0c83
	> user::rwx
rpm-build 0a0c83
	> user:root:---
rpm-build 0a0c83
	> user:daemon:rw-	#effective:---
rpm-build 0a0c83
	> group::r-x	#effective:---
rpm-build 0a0c83
	> mask::---
rpm-build 0a0c83
	> other::---
rpm-build 0a0c83
	>
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl -m u::rwx,g::r-x,o:-,u:root:-,m:- g
rpm-build 0a0c83
	$ getfacl g
rpm-build 0a0c83
	> # file: g
rpm-build 0a0c83
	> # owner: bin
rpm-build 0a0c83
	> # group: bin
rpm-build 0a0c83
	> user::rwx
rpm-build 0a0c83
	> user:root:---
rpm-build 0a0c83
	> user:daemon:rw-	#effective:---
rpm-build 0a0c83
	> group::r-x	#effective:---
rpm-build 0a0c83
	> mask::---
rpm-build 0a0c83
	> other::---
rpm-build 0a0c83
	>
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl -m u::rwx,g::r-x,o:-,u:root:- g
rpm-build 0a0c83
	$ getfacl g
rpm-build 0a0c83
	> # file: g
rpm-build 0a0c83
	> # owner: bin
rpm-build 0a0c83
	> # group: bin
rpm-build 0a0c83
	> user::rwx
rpm-build 0a0c83
	> user:root:---
rpm-build 0a0c83
	> user:daemon:rw-
rpm-build 0a0c83
	> group::r-x
rpm-build 0a0c83
	> mask::rwx
rpm-build 0a0c83
	> other::---
rpm-build 0a0c83
	>
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl --test -x u: g
rpm-build 0a0c83
	> setfacl: g: Malformed access ACL `user:root:---,user:daemon:rw-,group::r-x,mask::rwx,other::---': Missing or wrong entry at entry 1
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl --test -x u:x
rpm-build 0a0c83
	> setfacl: Option -x: Invalid argument near character 3
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl -m d:u:root:rwx g
rpm-build 0a0c83
	> setfacl: g: Only directories can have default ACLs
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl -x m g
rpm-build 0a0c83
	> setfacl: g: Malformed access ACL `user::rwx,user:root:---,user:daemon:rw-,group::r-x,other::---': Missing or wrong entry at entry 5
rpm-build 0a0c83
	 setfacl --test -m d:u:daemon:rwx setfacl
rpm-build 0a0c83
	 setfacl --test -n -m d:u:daemon:rwx setfacl
rpm-build 0a0c83
rpm-build 0a0c83
Check if the mask is properly recalculated
rpm-build 0a0c83
rpm-build 0a0c83
	$ mkdir d
rpm-build 0a0c83
	$ setfacl --test -m u::rwx,u:bin:rwx,g::r-x,o::--- d
rpm-build 0a0c83
	> d: u::rwx,u:bin:rwx,g::r-x,m::rwx,o::---,*
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl --test -m u::rwx,u:bin:rwx,g::r-x,m::---,o::--- d
rpm-build 0a0c83
	> d: u::rwx,u:bin:rwx,g::r-x,m::---,o::---,*
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl --test -d -m u::rwx,u:bin:rwx,g::r-x,o::--- d
rpm-build 0a0c83
	> d: *,d:u::rwx,d:u:bin:rwx,d:g::r-x,d:m::rwx,d:o::---
rpm-build 0a0c83
rpm-build 0a0c83
	$ setfacl --test -d -m u::rwx,u:bin:rwx,g::r-x,m::---,o::--- d
rpm-build 0a0c83
	> d: *,d:u::rwx,d:u:bin:rwx,d:g::r-x,d:m::---,d:o::---
rpm-build 0a0c83
rpm-build 0a0c83
	$ su
rpm-build 0a0c83
	$ cd ..
rpm-build 0a0c83
	$ rm -r d