diff options
author | netblue30 <netblue30@protonmail.com> | 2022-02-08 10:30:22 -0500 |
---|---|---|
committer | netblue30 <netblue30@protonmail.com> | 2022-02-08 10:30:22 -0500 |
commit | 86a57917aa2ef664cc27865a235860412a0a381d (patch) | |
tree | 1187f5385d2cf2f4b2bee9af2bc30f906f519b20 /test | |
parent | Merge pull request #4912 from netblue30/ci_centos (diff) | |
download | firejail-86a57917aa2ef664cc27865a235860412a0a381d.tar.gz firejail-86a57917aa2ef664cc27865a235860412a0a381d.tar.zst firejail-86a57917aa2ef664cc27865a235860412a0a381d.zip |
fix --private-cwd, issue #4910
Diffstat (limited to 'test')
-rwxr-xr-x | test/fs/private-cwd.exp | 48 | ||||
-rw-r--r-- | test/fs/private-cwd.profile | 1 |
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 | |||
7 | spawn $env(SHELL) | 7 | spawn $env(SHELL) |
8 | match_max 100000 | 8 | match_max 100000 |
9 | 9 | ||
10 | send -- "cd /tmp\r" | 10 | send -- "firejail --private-cwd pwd\r" |
11 | after 100 | ||
12 | |||
13 | # testing profile and private | ||
14 | send -- "firejail --private-cwd\r" | ||
15 | expect { | 11 | expect { |
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 | } |
19 | sleep 1 | 15 | sleep 1 |
20 | 16 | ||
21 | send -- "pwd\r" | 17 | send -- "firejail --private-cwd=/etc pwd\r" |
22 | expect { | 18 | expect { |
23 | timeout {puts "TESTING ERROR 1\n";exit} | 19 | timeout {puts "TESTING ERROR 2\n";exit} |
24 | "$env(HOME)" | 20 | "/etc" |
25 | } | 21 | } |
26 | after 100 | ||
27 | |||
28 | send -- "exit\r" | ||
29 | sleep 1 | 22 | sleep 1 |
30 | 23 | ||
31 | send -- "cd /\r" | 24 | send -- "firejail --private --private-cwd=. pwd\r" |
32 | after 100 | ||
33 | |||
34 | # testing profile and private | ||
35 | send -- "firejail --private-cwd=/tmp\r" | ||
36 | expect { | 25 | expect { |
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 | } |
40 | sleep 1 | 29 | sleep 1 |
41 | 30 | ||
42 | send -- "pwd\r" | 31 | after 100 |
32 | send -- "firejail --private-cwd='\${HOME}' pwd\r" | ||
43 | expect { | 33 | expect { |
44 | timeout {puts "TESTING ERROR 4\n";exit} | 34 | timeout {puts "TESTING ERROR 4\n";exit} |
45 | "/tmp" | 35 | "$env(HOME)" |
46 | } | 36 | } |
47 | after 100 | 37 | sleep 1 |
48 | 38 | ||
49 | send -- "exit\r" | 39 | after 100 |
40 | send -- "firejail --private-cwd=\"\${HOME}\" pwd\r" | ||
41 | expect { | ||
42 | timeout {puts "TESTING ERROR 5\n";exit} | ||
43 | "$env(HOME)" | ||
44 | } | ||
50 | sleep 1 | 45 | sleep 1 |
51 | 46 | ||
47 | send -- "firejail --profile=private-cwd.profile pwd\r" | ||
48 | expect { | ||
49 | timeout {puts "TESTING ERROR 6\n";exit} | ||
50 | "$env(HOME)" | ||
51 | } | ||
52 | after 100 | ||
53 | |||
52 | puts "all done\n" | 54 | puts "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} | |||