-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix interactive restricted shell behavior
Fixes #1459
- Loading branch information
1 parent
46d4981
commit 1fd82bd
Showing
8 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
# This is used by a Meson custom_target() to create a "rksh" symlink to the | ||
# "ksh" binary. This is slightly convoluted to support platforms, such as | ||
# Cygwin, where the ksh binary might have an extension such as ".exe". | ||
cmd=$(basename "$1") | ||
cd "$(dirname "$1")" || exit 1 | ||
rm -f "r$cmd" | ||
ln -s "$cmd" "r$cmd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# vim: set filetype=expect: | ||
# | ||
# Interactive tests of restricted shell behavior. This is primarily to avoid regressions of | ||
# https://github.com/att/ast/issues/1459. It doesn't need to be a comprehensive test of restricted | ||
# shell behavior. That is already done in unit test restricted.sh. | ||
set pid [spawn $rksh] | ||
expect_prompt | ||
# Terminal rows and columns may default to zero so ensure sane values. | ||
send "stty rows 24 cols 80\r" | ||
expect_prompt | ||
|
||
# ========== | ||
# Changing a restricted env var should be an error. | ||
log_test_entry | ||
send "PATH=/bin\r" | ||
expect -re ": PATH: restricted\r\n" { | ||
puts "modifying PATH is restricted" | ||
} | ||
expect_prompt | ||
|
||
# ========== | ||
# Exit the shell. | ||
log_test_entry | ||
send "\r" | ||
expect_prompt | ||
send [ctrl D] | ||
catch {expect default exp_continue} output | ||
log_debug "EOF output: $output" | ||
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
modifying PATH is restricted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters