Blob Blame History Raw
#!/usr/bin/expect -f
# Author: Iain Douglas <centos@1n6.org.uk>
#

set testpassword [lindex $argv 0]
set timeout 10
match_max 6000

spawn su passtest -c passwd
expect  -re "(UNIX|Current) password:" { send -- "passtest\r" }
expect {
    "password:" {
         send "$testpassword\r"
         expect {
             "BAD PASSWORD: is a palindrome" { exit 0 }
             "BAD PASSWORD: The password is a palindrome" { exit 0 }
             "BAD PASSWORD: it is WAY too short" { exit 0 }
             "BAD PASSWORD: The password is shorter than 8 characters" { exit 0 }
             "BAD PASSWORD: it is too short" { exit 0 }
             "BAD PASSWORD: it does not contain enough DIFFERENT characters" { exit 0 }
             "BAD PASSWORD: The password fails the dictionary check - it does not contain enough DIFFERENT characters" { exit 0 }
         }
     }
}
exit 1