From 86a57917aa2ef664cc27865a235860412a0a381d Mon Sep 17 00:00:00 2001 From: netblue30 Date: Tue, 8 Feb 2022 10:30:22 -0500 Subject: fix --private-cwd, issue #4910 --- test/fs/private-cwd.exp | 48 +++++++++++++++++++++++---------------------- test/fs/private-cwd.profile | 1 + 2 files changed, 26 insertions(+), 23 deletions(-) create mode 100644 test/fs/private-cwd.profile (limited to 'test/fs') 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 spawn $env(SHELL) match_max 100000 -send -- "cd /tmp\r" -after 100 - -# testing profile and private -send -- "firejail --private-cwd\r" +send -- "firejail --private-cwd pwd\r" expect { - timeout {puts "TESTING ERROR 0\n";exit} - "Child process initialized" + timeout {puts "TESTING ERROR 1\n";exit} + "$env(HOME)" } sleep 1 -send -- "pwd\r" +send -- "firejail --private-cwd=/etc pwd\r" expect { - timeout {puts "TESTING ERROR 1\n";exit} - "$env(HOME)" + timeout {puts "TESTING ERROR 2\n";exit} + "/etc" } -after 100 - -send -- "exit\r" sleep 1 -send -- "cd /\r" -after 100 - -# testing profile and private -send -- "firejail --private-cwd=/tmp\r" +send -- "firejail --private --private-cwd=. pwd\r" expect { timeout {puts "TESTING ERROR 3\n";exit} - "Child process initialized" + "invalid private working directory" } sleep 1 -send -- "pwd\r" +after 100 +send -- "firejail --private-cwd='\${HOME}' pwd\r" expect { timeout {puts "TESTING ERROR 4\n";exit} - "/tmp" + "$env(HOME)" } -after 100 +sleep 1 -send -- "exit\r" +after 100 +send -- "firejail --private-cwd=\"\${HOME}\" pwd\r" +expect { + timeout {puts "TESTING ERROR 5\n";exit} + "$env(HOME)" +} sleep 1 +send -- "firejail --profile=private-cwd.profile pwd\r" +expect { + timeout {puts "TESTING ERROR 6\n";exit} + "$env(HOME)" +} +after 100 + 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} -- cgit v1.2.3-54-g00ecf