From 16ce4111780031fb685c41d7abb8416f2454a51a Mon Sep 17 00:00:00 2001 From: Steve Beattie Date: Fri, 14 Apr 2006 18:11:55 +0000 Subject: [PATCH] [https://bugzilla.novell.com/show_bug.cgi?id=165177] XFS appears to be more strict than the Linux vfs layer wrt whether a process can chgrp a file when it's not the owner but still in the same group -- XFS doesn't allow it and requires CAP_FOWNER instead. This fix rorders the tests so that the chgrp operations occur before the chown operations happen, avoiding the difference in requirements between XFS and linux's vfs. --- tests/regression/subdomain/setattr.sh | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/tests/regression/subdomain/setattr.sh b/tests/regression/subdomain/setattr.sh index b20605c5c..3ea1af30b 100644 --- a/tests/regression/subdomain/setattr.sh +++ b/tests/regression/subdomain/setattr.sh @@ -71,14 +71,20 @@ newgid=$(awk -F: "/^${newgroup}:/ {print \$3}" /etc/group) touch $file chmod $origfileperm $file +# NOTE on the ordering of tests: XFS requires the FOWNER capability +# to chgrp a file that you are not the owner of; linux's vfs layer will +# allow you to do it if you are in the group of the file without FOWNER. +# Therefore, we should do the chgrp test BEFORE changing the owner of +# the file. + # PASS TEST (UNCONSTRAINED) settest chmod runchecktest "CHMOD (unconstrained)" pass $file $newfileperm -settest chown -runchecktest "CHOWN (unconstrained)" pass $file $newuid settest chgrp runchecktest "CHGRP (unconstrained)" pass $file $newgid +settest chown +runchecktest "CHOWN (unconstrained)" pass $file $newuid checkfile $file "unconstrained" $newfilepermstr $newuser $newgroup @@ -91,14 +97,14 @@ settest chmod genprofile $file:$okperm runchecktest "CHMOD (constrained $okperm)" pass $file 000 -settest chown -genprofile $file:$okperm $pwfiles capability:chown -runchecktest "CHOWN (constrained $okperm)" pass $file $newuid - settest chgrp genprofile $file:$okperm $pwfiles capability:chown runchecktest "CHGRP (constrained $okperm)" pass $file $newgid +settest chown +genprofile $file:$okperm $pwfiles capability:chown +runchecktest "CHOWN (constrained $okperm)" pass $file $newuid + checkfile $file "constrained $okperm" $newfilepermstr $newuser $newgroup # FAIL TEST (CONSTRAINED) @@ -110,12 +116,12 @@ settest chmod genprofile $file:$badperm $pwfiles runchecktest "CHMOD (constrained $badperm)" fail $file 000 -settest chown -genprofile $file:$badperm $pwfiles -runchecktest "CHOWN (constrained $badperm)" fail $file $newuid - settest chgrp genprofile $file:$badperm $pwfiles runchecktest "CHGRP (constrained $badperm)" fail $file $newgid +settest chown +genprofile $file:$badperm $pwfiles +runchecktest "CHOWN (constrained $badperm)" fail $file $newuid + checkfile $file "constrained $badperm" $origfilepermstr $origuser $origgroup