File: test-pseudo_disable-fork-env_i.sh

package info (click to toggle)
pseudo 1.8.1%2Bgit20161012-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,804 kB
  • ctags: 927
  • sloc: ansic: 11,729; sh: 760; python: 749; makefile: 158
file content (30 lines) | stat: -rwxr-xr-x 681 bytes parent folder | download | duplicates (2)
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
#!/bin/bash

# Verify normal operation...
uid=`env -i id -u`
gid=`env -i id -g`
if [ $uid -ne 0 -o $gid -ne 0 ]; then
    exit 1
fi

export PSEUDO_DISABLED=1
# Verify we dropped OUT of pseudo control, even with env -i
# This checks that env -i replacement functionality still works
# as expected
uid=`env -i id -u`
gid=`env -i id -g`
if [ $uid -eq 0 -o $gid -eq 0 ]; then
    exit 1
fi

export PSEUDO_DISABLED=1
# Verify we can change PSEUDO_DISABLED, even with env -i
# This checks that env -i replacement functionality still works
# as expected
uid=`env -i PSEUDO_DISABLED=0 id -u`
gid=`env -i PSEUDO_DISABLED=0 id -g`
if [ $uid -ne 0 -o $gid -ne 0 ]; then
    exit 1
fi

exit 0