view tests/test-idpriv-droptemp.su.sh @ 17622:71e733c62cee

savedir: add sorting arg to savedir, streamsavedir; remove fdsavedir Patch based on an idea by Dick Streefland in <https://savannah.gnu.org/patch/?7892>. * NEWS: Document this. * lib/savedir.c (NAME_SIZE_DEFAULT): Remove. (direntry_t, comparison_function): New types. (direntry_cmp_name): New function. (direntry_cmp_inode) [D_INO_IN_DIRENT]: New function. (streamsavedir, savedir): New arg OPTION. (streamsavedir): Simplify memory allocation. (fdsavedir): Remove. * lib/savedir.h (enum savedir_option): New type. (streamsavedir, savedir): New arg OPTION. (fdsavedir): Remove.
author Sergey Poznyakoff <gray@gnu.org.ua>
date Thu, 13 Feb 2014 22:01:39 +0200
parents c992e0b3355b
children
line wrap: on
line source

#!/bin/sh
# This script must be run as superuser.

origuid=$1
origgid=$2

# A POSIX compliant 'id' program.
if test -f /usr/xpg4/bin/id; then
  ID=/usr/xpg4/bin/id
else
  ID=id
fi

if test `$ID -u` != 0; then
  echo "Skipping test: not superuser"
  exit 77
fi

./test-idpriv-droptemp${EXEEXT} || exit 13      # normal

chown root:root test-idpriv-droptemp${EXEEXT} 2>/dev/null || \
chown root:wheel test-idpriv-droptemp${EXEEXT} 2>/dev/null || \
  { echo "Skipping test: root privilege not sufficient on this file system"
    exit 77
  }
chmod 4755 test-idpriv-droptemp${EXEEXT}
./test-idpriv-droptemp${EXEEXT} || exit 13      # setuid root
chmod 2755 test-idpriv-droptemp${EXEEXT}
./test-idpriv-droptemp${EXEEXT} || exit 13      # setgid root
chmod 6755 test-idpriv-droptemp${EXEEXT}
./test-idpriv-droptemp${EXEEXT} || exit 13      # setuid and setgid root

if chown nobody test-idpriv-droptemp${EXEEXT} 2>/dev/null; then
  chmod 4755 test-idpriv-droptemp${EXEEXT}
  ./test-idpriv-droptemp${EXEEXT} || exit 13    # setuid nobody
  chmod 2755 test-idpriv-droptemp${EXEEXT}
  ./test-idpriv-droptemp${EXEEXT} || exit 13    # setgid root
  chmod 6755 test-idpriv-droptemp${EXEEXT}
  ./test-idpriv-droptemp${EXEEXT} || exit 13    # setuid nobody and setgid root
fi

if chown root:nobody test-idpriv-droptemp${EXEEXT} 2>/dev/null; then
  chmod 4755 test-idpriv-droptemp${EXEEXT}
  ./test-idpriv-droptemp${EXEEXT} || exit 13    # setuid root
  chmod 2755 test-idpriv-droptemp${EXEEXT}
  ./test-idpriv-droptemp${EXEEXT} || exit 13    # setgid nobody
  chmod 6755 test-idpriv-droptemp${EXEEXT}
  ./test-idpriv-droptemp${EXEEXT} || exit 13    # setuid root and setgid nobody
fi

chown "$origuid:$origgid" test-idpriv-droptemp${EXEEXT}
chmod 755 test-idpriv-droptemp${EXEEXT}