aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar smitsohu <smitsohu@gmail.com>2019-05-24 21:28:10 +0200
committerLibravatar GitHub <noreply@github.com>2019-05-24 21:28:10 +0200
commit9314fff8cb801e3f2f7a2996764c12ca4e350bea (patch)
tree58416f0e3a01b43f8265ff785c255eaa97e73e65 /test
parentadd header guard to firecfg.h (diff)
parentAdd private-cwd option to control working directory within jail (diff)
downloadfirejail-9314fff8cb801e3f2f7a2996764c12ca4e350bea.tar.gz
firejail-9314fff8cb801e3f2f7a2996764c12ca4e350bea.tar.zst
firejail-9314fff8cb801e3f2f7a2996764c12ca4e350bea.zip
Merge pull request #2712 from apmorton/features/private-cwd
Add private-cwd option to control working directory within jail
Diffstat (limited to 'test')
-rwxr-xr-xtest/fs/fs.sh3
-rwxr-xr-xtest/fs/private-cwd.exp52
2 files changed, 55 insertions, 0 deletions
diff --git a/test/fs/fs.sh b/test/fs/fs.sh
index 0fc216b20..7e1d46f0a 100755
--- a/test/fs/fs.sh
+++ b/test/fs/fs.sh
@@ -69,6 +69,9 @@ echo "TESTING: empty private-etc (test/fs/private-etc-empty.exp)"
69echo "TESTING: private-bin (test/fs/private-bin.exp)" 69echo "TESTING: private-bin (test/fs/private-bin.exp)"
70./private-bin.exp 70./private-bin.exp
71 71
72echo "TESTING: private-cwd (test/fs/private-cwd.exp)"
73./private-cwd.exp
74
72echo "TESTING: macros (test/fs/macro.exp)" 75echo "TESTING: macros (test/fs/macro.exp)"
73./macro.exp 76./macro.exp
74 77
diff --git a/test/fs/private-cwd.exp b/test/fs/private-cwd.exp
new file mode 100755
index 000000000..0fa87a92f
--- /dev/null
+++ b/test/fs/private-cwd.exp
@@ -0,0 +1,52 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2019 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "cd /tmp\r"
11after 100
12
13# testing profile and private
14send -- "firejail --private-cwd\r"
15expect {
16 timeout {puts "TESTING ERROR 0\n";exit}
17 "Child process initialized"
18}
19sleep 1
20
21send -- "pwd\r"
22expect {
23 timeout {puts "TESTING ERROR 1\n";exit}
24 "$env(HOME)"
25}
26after 100
27
28send -- "exit\r"
29sleep 1
30
31send -- "cd /\r"
32after 100
33
34# testing profile and private
35send -- "firejail --private-cwd=/tmp\r"
36expect {
37 timeout {puts "TESTING ERROR 3\n";exit}
38 "Child process initialized"
39}
40sleep 1
41
42send -- "pwd\r"
43expect {
44 timeout {puts "TESTING ERROR 4\n";exit}
45 "/tmp"
46}
47after 100
48
49send -- "exit\r"
50sleep 1
51
52puts "all done\n"