summaryrefslogtreecommitdiffstats
path: root/tests/tests/grouptools/groupmems/58_groupmems_authentication_failure1/run_groupmems.exp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tests/grouptools/groupmems/58_groupmems_authentication_failure1/run_groupmems.exp')
-rwxr-xr-xtests/tests/grouptools/groupmems/58_groupmems_authentication_failure1/run_groupmems.exp44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/tests/grouptools/groupmems/58_groupmems_authentication_failure1/run_groupmems.exp b/tests/tests/grouptools/groupmems/58_groupmems_authentication_failure1/run_groupmems.exp
new file mode 100755
index 0000000..b42b92e
--- /dev/null
+++ b/tests/tests/grouptools/groupmems/58_groupmems_authentication_failure1/run_groupmems.exp
@@ -0,0 +1,44 @@
+#!/usr/bin/expect
+
+set timeout 3
+expect_after default {puts stderr "\nFAIL"; exit 1}
+
+if {$argc != 0} {
+ puts "usage: run_groupmems.exp"
+ exit 1
+}
+
+# First, switch to the testsuite user
+# (otherwise, no password will be asked)
+send_user "# switch to the 'myuser' user\n"
+send_user "# and expect a '$ ' prompt\n"
+spawn /bin/su myuser
+
+expect "$ " ;# Wait for the prompt
+
+send_user "\n# make sure we are now 'myuser'"
+send_user "\n# id should return 'uid=424242(myuser) gid=424242(myuser) groups=424242(myuser),99(groupmems)'"
+send "\r" ;# restore the prompt for the logs
+send "id\r" ;# Verify we are really testsuite
+
+expect "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser),99(groupmems)"
+
+expect "$ " ;# Wait for the prompt
+
+send_user "\n\n"
+send_user "# now add user utest1 to the myuser group\n"
+send_user "# and expect a password prompt"
+send "\r" ;# restore the prompt for the logs
+send "/usr/sbin/groupmems -a nobody\r"
+expect "Password: "
+send "!myuserF00barbaz\r"
+expect -re "groupmems: PAM: Authentication failure\r"
+
+expect "$ " ;# Wait for the prompt
+send "echo $?\r"
+expect "1\r"
+expect "$ " ;# Wait for the prompt
+close
+
+puts "\nPASS"
+exit 0