bstinson / centos / t_functional

Forked from centos/t_functional 3 years ago
Clone

Blame tests/p_passwd/_password_complexity.expect

Iain Douglas 756e5d
#!/usr/bin/expect -f
Iain Douglas 756e5d
# Author: Iain Douglas <centos@1n6.org.uk>
Iain Douglas 756e5d
#
Iain Douglas 756e5d
Iain Douglas 756e5d
set testpassword [lindex $argv 0]
Iain Douglas 756e5d
set timeout 10
Iain Douglas 756e5d
match_max 6000
Iain Douglas 756e5d
Iain Douglas 756e5d
spawn su passtest -c passwd
Pablo Greco c9ea90
expect  -re "(UNIX|Current) password:" { send -- "passtest\r" }
Iain Douglas 756e5d
expect {
Iain Douglas 756e5d
    "password:" {
Iain Douglas 756e5d
         send "$testpassword\r"
Iain Douglas 756e5d
         expect {
c75df3
             "BAD PASSWORD: is a palindrome" { exit 0 }
c75df3
             "BAD PASSWORD: The password is a palindrome" { exit 0 }
Iain Douglas 756e5d
             "BAD PASSWORD: it is WAY too short" { exit 0 }
c75df3
             "BAD PASSWORD: The password is shorter than 8 characters" { exit 0 }
Iain Douglas 756e5d
             "BAD PASSWORD: it is too short" { exit 0 }
Iain Douglas 756e5d
             "BAD PASSWORD: it does not contain enough DIFFERENT characters" { exit 0 }
c75df3
             "BAD PASSWORD: The password fails the dictionary check - it does not contain enough DIFFERENT characters" { exit 0 }
Iain Douglas 756e5d
         }
Iain Douglas 756e5d
     }
Iain Douglas 756e5d
}
Iain Douglas 756e5d
exit 1