aboutsummaryrefslogtreecommitdiffstats
path: root/test/fs
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@protonmail.com>2022-02-08 10:30:22 -0500
committerLibravatar netblue30 <netblue30@protonmail.com>2022-02-08 10:30:22 -0500
commit86a57917aa2ef664cc27865a235860412a0a381d (patch)
tree1187f5385d2cf2f4b2bee9af2bc30f906f519b20 /test/fs
parentMerge pull request #4912 from netblue30/ci_centos (diff)
downloadfirejail-86a57917aa2ef664cc27865a235860412a0a381d.tar.gz
firejail-86a57917aa2ef664cc27865a235860412a0a381d.tar.zst
firejail-86a57917aa2ef664cc27865a235860412a0a381d.zip
fix --private-cwd, issue #4910
Diffstat (limited to 'test/fs')
-rwxr-xr-xtest/fs/private-cwd.exp48
-rw-r--r--test/fs/private-cwd.profile1
2 files changed, 26 insertions, 23 deletions
diff --git a/test/fs/private-cwd.exp b/test/fs/private-cwd.exp
index e9c4bdacd..77374e086 100755
--- a/test/fs/private-cwd.exp
+++ b/test/fs/private-cwd.exp
@@ -7,46 +7,48 @@ set timeout 10
7spawn $env(SHELL) 7spawn $env(SHELL)
8match_max 100000 8match_max 100000
9 9
10send -- "cd /tmp\r" 10send -- "firejail --private-cwd pwd\r"
11after 100
12
13# testing profile and private
14send -- "firejail --private-cwd\r"
15expect { 11expect {
16 timeout {puts "TESTING ERROR 0\n";exit} 12 timeout {puts "TESTING ERROR 1\n";exit}
17 "Child process initialized" 13 "$env(HOME)"
18} 14}
19sleep 1 15sleep 1
20 16
21send -- "pwd\r" 17send -- "firejail --private-cwd=/etc pwd\r"
22expect { 18expect {
23 timeout {puts "TESTING ERROR 1\n";exit} 19 timeout {puts "TESTING ERROR 2\n";exit}
24 "$env(HOME)" 20 "/etc"
25} 21}
26after 100
27
28send -- "exit\r"
29sleep 1 22sleep 1
30 23
31send -- "cd /\r" 24send -- "firejail --private --private-cwd=. pwd\r"
32after 100
33
34# testing profile and private
35send -- "firejail --private-cwd=/tmp\r"
36expect { 25expect {
37 timeout {puts "TESTING ERROR 3\n";exit} 26 timeout {puts "TESTING ERROR 3\n";exit}
38 "Child process initialized" 27 "invalid private working directory"
39} 28}
40sleep 1 29sleep 1
41 30
42send -- "pwd\r" 31after 100
32send -- "firejail --private-cwd='\${HOME}' pwd\r"
43expect { 33expect {
44 timeout {puts "TESTING ERROR 4\n";exit} 34 timeout {puts "TESTING ERROR 4\n";exit}
45 "/tmp" 35 "$env(HOME)"
46} 36}
47after 100 37sleep 1
48 38
49send -- "exit\r" 39after 100
40send -- "firejail --private-cwd=\"\${HOME}\" pwd\r"
41expect {
42 timeout {puts "TESTING ERROR 5\n";exit}
43 "$env(HOME)"
44}
50sleep 1 45sleep 1
51 46
47send -- "firejail --profile=private-cwd.profile pwd\r"
48expect {
49 timeout {puts "TESTING ERROR 6\n";exit}
50 "$env(HOME)"
51}
52after 100
53
52puts "all done\n" 54puts "all done\n"
diff --git a/test/fs/private-cwd.profile b/test/fs/private-cwd.profile
new file mode 100644
index 000000000..9dd97a8ac
--- /dev/null
+++ b/test/fs/private-cwd.profile
@@ -0,0 +1 @@
private-cwd ${HOME}