aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2010-12-07 20:43:45 -0600
committerPeter Seebach <peter.seebach@windriver.com>2010-12-07 20:47:19 -0600
commit98f16482f1e5c4b9c9d3b0803d41565a350af53d (patch)
tree4af00226b5b0b3b79ff26b51aedb2c5af15f58fe /test
parent7b2dd4c7a6e20a8fe78cb892a8406d6d119c415b (diff)
downloadpseudo-98f16482f1e5c4b9c9d3b0803d41565a350af53d.tar.gz
pseudo-98f16482f1e5c4b9c9d3b0803d41565a350af53d.tar.bz2
pseudo-98f16482f1e5c4b9c9d3b0803d41565a350af53d.zip
This is a merge of several commits from a tree which turned out to
be out of sync in a very inconvenient way. Changes include: * Some whitespace fixes, also move the pseudo_variables definition into pseudo_util.c since it's not used anywhere else. * Further improvements in the fork() support: We now recognize both positive and negative forms of PSEUDO_DISABLED, so we can distinguish between "it was removed from the environment by env -i" (restore the old value) and "it was intentionally turned off" (the new value wins). * clone(2) support. This is a little primitive, and programs might still fail horribly due to clone's semantics, but at least it's there and passes easy test cases. Plus a big patch from Mark Hatle: Cleanup fork/clone and PSEUDO_DISABLED guts/fork.c: * cleanup function and make it more robust * be sure to call pseudo_setupenv prior to pseudo_client_reset to match exec behavior pseudo_wrappers.c: * fix mismatched type in execl_to_v call via typecast * Simplify fork call via single call to wrap_fork() * be sure to save pseudo_disabled * be sure to call pseudo_setupenv prior to pseudo_client_reset to match exec behavior tests: * Add a test of whether pseudo can be disabled/enabled on a fork. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/test-forkoff-env_i.sh30
-rwxr-xr-xtest/test-forkoff.sh18
2 files changed, 48 insertions, 0 deletions
diff --git a/test/test-forkoff-env_i.sh b/test/test-forkoff-env_i.sh
new file mode 100755
index 0000000..1e679aa
--- /dev/null
+++ b/test/test-forkoff-env_i.sh
@@ -0,0 +1,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
diff --git a/test/test-forkoff.sh b/test/test-forkoff.sh
new file mode 100755
index 0000000..13a42a4
--- /dev/null
+++ b/test/test-forkoff.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# Verify normal operation...
+uid=`id -u`
+gid=`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
+uid=`id -u`
+gid=`id -g`
+if [ $uid -eq 0 -o $gid -eq 0 ]; then
+ exit 1
+fi
+
+exit 0