blob: 7dcbf5793915a7c74332267b815abad981bffeab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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
${CHECKER} ./test-idpriv-drop${EXEEXT} || exit 13 # normal
chown root:root test-idpriv-drop${EXEEXT} 2>/dev/null || \
chown root:wheel test-idpriv-drop${EXEEXT} 2>/dev/null || \
{ echo "Skipping test: root privilege not sufficient on this file system"
exit 77
}
chmod 4755 test-idpriv-drop${EXEEXT}
./test-idpriv-drop${EXEEXT} || exit 13 # setuid root
chmod 2755 test-idpriv-drop${EXEEXT}
./test-idpriv-drop${EXEEXT} || exit 13 # setgid root
chmod 6755 test-idpriv-drop${EXEEXT}
./test-idpriv-drop${EXEEXT} || exit 13 # setuid and setgid root
if chown nobody test-idpriv-drop${EXEEXT} 2>/dev/null; then
chmod 4755 test-idpriv-drop${EXEEXT}
./test-idpriv-drop${EXEEXT} || exit 13 # setuid nobody
chmod 2755 test-idpriv-drop${EXEEXT}
./test-idpriv-drop${EXEEXT} || exit 13 # setgid root
chmod 6755 test-idpriv-drop${EXEEXT}
./test-idpriv-drop${EXEEXT} || exit 13 # setuid nobody and setgid root
fi
if chown root:nobody test-idpriv-drop${EXEEXT} 2>/dev/null; then
chmod 4755 test-idpriv-drop${EXEEXT}
./test-idpriv-drop${EXEEXT} || exit 13 # setuid root
chmod 2755 test-idpriv-drop${EXEEXT}
./test-idpriv-drop${EXEEXT} || exit 13 # setgid nobody
chmod 6755 test-idpriv-drop${EXEEXT}
./test-idpriv-drop${EXEEXT} || exit 13 # setuid root and setgid nobody
fi
chown "$origuid:$origgid" test-idpriv-drop${EXEEXT}
chmod 755 test-idpriv-drop${EXEEXT}
|