aboutsummaryrefslogtreecommitdiffstats
path: root/test/test-pseudo_disable-fork-env_i.sh
blob: 1e679aa416a020dd07d15e3970a9a5bef2ba451e (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
#!/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