summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2021-08-30 15:04:46 +0200
committert3sserakt <t3ss@posteo.de>2021-08-30 15:04:46 +0200
commitc66295e27c44c3ad4453f0d7ba9ccd905a6decb8 (patch)
tree4df73912ace5e31c9e16ac778edd1d1ee2cfd997 /src/testing
parent744538ba3d388c3befa367c75d9a85126430cf8e (diff)
- introduced nested namespace in test script to get rid of the permission problem, renamed test file.
Diffstat (limited to 'src/testing')
-rwxr-xr-xsrc/testing/netjail_core.sh11
-rwxr-xr-xsrc/testing/netjail_exec.sh2
2 files changed, 11 insertions, 2 deletions
diff --git a/src/testing/netjail_core.sh b/src/testing/netjail_core.sh
index f49d4b312..cf350d3fa 100755
--- a/src/testing/netjail_core.sh
+++ b/src/testing/netjail_core.sh
@@ -1,7 +1,7 @@
#!/bin/sh
#
-JAILOR=${SUDO_USER:?must run in sudo}
+
# running with `sudo` is required to be
# able running the actual commands as the
@@ -90,6 +90,7 @@ netjail_node_add_default() {
}
netjail_node_exec() {
+ JAILOR=${SUDO_USER:?must run in sudo}
NODE=$1
FD_IN=$2
FD_OUT=$3
@@ -99,9 +100,17 @@ netjail_node_exec() {
}
netjail_node_exec_without_fds() {
+ JAILOR=${SUDO_USER:?must run in sudo}
NODE=$1
shift 1
ip netns exec $NODE sudo -u $JAILOR -- $@
}
+netjail_node_exec_without_fds_and_sudo() {
+ NODE=$1
+ shift 1
+
+ ip netns exec $NODE $@
+}
+
diff --git a/src/testing/netjail_exec.sh b/src/testing/netjail_exec.sh
index c20a8c117..17a7caaac 100755
--- a/src/testing/netjail_exec.sh
+++ b/src/testing/netjail_exec.sh
@@ -13,4 +13,4 @@ NODE=$(netjail_print_name "N" $N $M)
-netjail_node_exec_without_fds $NODE $3 $4 $5 $1 $2
+netjail_node_exec_without_fds_and_sudo $NODE $3 $4 $5 $1 $2