summaryrefslogtreecommitdiffstats
path: root/tests/tests/chsh/08_chsh_myuser_to_restricted_shell/run.exp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 16:18:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 16:18:39 +0000
commit5242eef8fc54636a41701fd9d7083ba6e4a4e0b3 (patch)
treee6a0980092957865a937cc0f34446df3d5194e99 /tests/tests/chsh/08_chsh_myuser_to_restricted_shell/run.exp
parentReleasing progress-linux version 1:4.13+dfsg1-5~progress7.99u1. (diff)
downloadshadow-5242eef8fc54636a41701fd9d7083ba6e4a4e0b3.tar.xz
shadow-5242eef8fc54636a41701fd9d7083ba6e4a4e0b3.zip
Merging upstream version 1:4.15.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/tests/chsh/08_chsh_myuser_to_restricted_shell/run.exp')
-rwxr-xr-xtests/tests/chsh/08_chsh_myuser_to_restricted_shell/run.exp41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/tests/chsh/08_chsh_myuser_to_restricted_shell/run.exp b/tests/tests/chsh/08_chsh_myuser_to_restricted_shell/run.exp
new file mode 100755
index 0000000..b1bd8d6
--- /dev/null
+++ b/tests/tests/chsh/08_chsh_myuser_to_restricted_shell/run.exp
@@ -0,0 +1,41 @@
+#!/usr/bin/expect
+
+set timeout 5
+
+if {$argc < 1} {
+ puts "usage: run.exp \[shell] \[user]"
+ exit 1
+}
+set shell [lindex $argv 0]
+
+if {$argc == 2} {
+ spawn /usr/bin/chsh [lindex $argv 1]
+} else {
+ spawn /usr/bin/chsh
+}
+
+expect "Password: "
+send "myuserF00barbaz\r"
+expect "Changing the login shell for myuser"
+expect "Enter the new value, or press ENTER for the default"
+expect -re "Login Shell .*\]: "
+send "$shell\r"
+expect "$shell\r\n"
+expect "chsh: $shell is an invalid shell\r\n"
+expect {
+ eof {
+ if ([string compare $expect_out(buffer) ""]) {
+ set fp [open "tmp/out" w]
+ puts $fp "$expect_out(buffer)"
+ puts "\nFAIL"
+ exit 1
+ }
+ } default {
+ puts "\nFAIL"
+ exit 1
+ }
+}
+
+puts "\nPASS"
+exit 0
+