From 8cc354ade3f27036dbd7bfa5140f2461ca0af588 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sun, 20 Oct 2013 23:44:42 +0200 Subject: Handle other responses in test_pamcmds This extends test_pamcmds to handle other pam/su/passwd errors and responses (as seen on CentOS 5). Also switch to stronger password when changing the test user's password to avoid problems with password strength checks. --- tests/test_pamcmds.expect | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/test_pamcmds.expect b/tests/test_pamcmds.expect index 567da54..7d5e3be 100644 --- a/tests/test_pamcmds.expect +++ b/tests/test_pamcmds.expect @@ -39,8 +39,9 @@ proc reset_password {} { spawn passwd arthur expect { "LDAP administrator password" { send "test\r"; exp_continue } - -regexp "(New|Retype new) password:" { send "test\r"; exp_continue } + -regexp "(New|Retype new)( UNIX)? password:" { send "test\r"; exp_continue } "password updated successfully" {} + "passwd: all authentication tokens updated successfully." {} "Invalid credentials" abort "Authentication token manipulation error" abort default abort @@ -80,8 +81,9 @@ proc test_login_ok {uid passwd} { expect "Password:" send "$passwd\r" expect { + "su: warning: cannot change directory" { exp_continue } "\$ " {} - "su: " abort + "su: incorrect password" abort default abort } # test whether we are really logged in @@ -101,6 +103,7 @@ proc test_login_authfail {uid passwd} { send "$passwd\r" expect { "su: Authentication failure" {} + "su: incorrect password" {} "\$ " abort default abort } @@ -114,6 +117,7 @@ proc test_login_unknown {uid passwd} { "Password:" { send "$passwd\r"; exp_continue } "Unknown id" {} "No passwd entry for user" {} + "user $uid does not exist" {} "\$ " abort default abort } @@ -137,8 +141,9 @@ expect { default abort } expect { - -regexp "(New|Retype new) password:" { send "newpassword\r"; exp_continue } + -regexp "(New|Retype new)( UNIX)? password:" { send "DuhevOlNoz5\r"; exp_continue } "password changed" abort + "all authentication tokens updated successfully." abort "Invalid credentials" {} "Authentication token manipulation error" {} "\$ " abort @@ -154,8 +159,9 @@ expect { default abort } expect { - -regexp "(New|Retype new) password:" { send "newpassword\r"; exp_continue } + -regexp "(New|Retype new)( UNIX)? password:" { send "DuhevOlNoz5\r"; exp_continue } "password updated successfully" {} + "all authentication tokens updated successfully." {} "Invalid credentials" abort "Authentication token manipulation error" abort "\$ " abort @@ -172,7 +178,7 @@ test_login_authfail arthur test # test correct password send_user "test_pamcmds.expect: testing new password...\n" -test_login_ok arthur newpassword +test_login_ok arthur DuhevOlNoz5 # test invalid username send_user "test_pamcmds.expect: testing with unknown username...\n" -- cgit v1.2.3