On 08/09/2012 05:43 PM, Ondrej Oprala wrote:
Hi, I think I got a fix for this bugzilla
https://bugzilla.redhat.com/show_bug.cgi?id=556358.
I added a bit of permission checking to require_root_ so no tests have
to be rewriten.
Have a nice day :) ,
Ondrej
Hi Ondrej,
+setuidgid_has_perm_()
+{
+
+ cat << \EOF > cmds.tmp
+ IFS=:
+ for DIR in $PATH; do
+ test -x $DIR || exit 1
+ done
+ exit 0
+EOF
+
+ su -s /bin/sh $NON_ROOT_USERNAME < cmds.tmp
+
+ RET=$?
+ return $RET
+}
+
just a thought: if setuidgid is part of the test failure,
then why not using setuidgid in here?
Furthermore: the problem is finding the correct binary, right?
E.g. in tests/rm/fail-2eperm there is already such a test:
# Try to ensure that $NON_ROOT_USERNAME can access
# the required version of rm.
rm_version=$(
setuidgid $NON_ROOT_USERNAME env PATH="$PATH" rm --version |
sed -n '1s/.* //p'
)
case $rm_version in
$PACKAGE_VERSION) ;;
*) skip_ "cannot access just-built rm as user $NON_ROOT_USERNAME";;
esac
Have a nice day,
Berny