diff options
Diffstat (limited to 'gnulib/tests/test-idpriv-droptemp.su.sh')
m--------- | gnulib | 0 | ||||
-rwxr-xr-x | gnulib/tests/test-idpriv-droptemp.su.sh | 52 |
2 files changed, 52 insertions, 0 deletions
diff --git a/gnulib b/gnulib deleted file mode 160000 -Subproject 443bc5ffcf7429e557f4a371b0661abe98ddbc1 diff --git a/gnulib/tests/test-idpriv-droptemp.su.sh b/gnulib/tests/test-idpriv-droptemp.su.sh new file mode 100755 index 0000000..74358f8 --- /dev/null +++ b/gnulib/tests/test-idpriv-droptemp.su.sh @@ -0,0 +1,52 @@ +#!/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} |