Well, I wanted to satisfy the requirements from comment #6 as much as possible and didn't want to change anything in the existing tests (such as passing args to require_root_ ) to make it more automatic. If the check were to act on setuidgid output like in the rm test, it'd either have to be changed in all tests or require_root_ would need additional arguments (which are again changes in the tests). But if it needs to be changed that way, I will, of course, redo it.
Cheers,
  Ondrej.

On 08/10/2012 08:53 AM, Bernhard Voelker wrote:
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


Reply via email to