view tests/test-idpriv-droptemp.su.sh @ 40226:5b87a9bf7240

uninorm tests: Free allocated memory. * tests/uninorm/test-u32-normalize-big.h (struct normalization_test_file): Remove 'const' from allocated member. (free_normalization_test_file): New declaration. * tests/uninorm/test-u32-normalize-big.c (test_other): Free allocated memory. (free_normalization_test_file): New function. * tests/uninorm/test-u32-nfc-big.c (main): Free allocated 'struct normalization_test_file' contents. * tests/uninorm/test-u32-nfd-big.c (main): Likewise. * tests/uninorm/test-u32-nfkc-big.c (main): Likewise. * tests/uninorm/test-u32-nfkd-big.c (main): Likewise.
author Bruno Haible <bruno@clisp.org>
date Sun, 10 Mar 2019 15:14:01 +0100
parents 8c1a17df67e0
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

${CHECKER} ./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}