3 # $Id: authsystem.passwd.in,v 1.2 2005/03/04 01:52:05 mrsam Exp $
5 # Copyright 2001-2005 Double Precision, Inc. See COPYING for
6 # distribution information.
8 # This script attempts to change a system account password in an automated
9 # fashion. This implemention is an "expect" script for the passwd command.
11 # This script reads two lines of text from stdin: old password, new password
12 # then runs the passwd command to change the password, and we attempt to parse
13 # the output of passwd.
15 # This implementation is for the basic "passwd" command. If it doesn't work
16 # for you, sorry: you're on your own. Some common pitfalls:
18 # * Enhanced passwd implementations that reject passwords based on dictionary
19 # words, etc.. This can result in unexpected output from the passwd command
20 # that this script may not be able to handle. We attempt to catch the most
21 # common error messages, below. Finally, we use a 30 second timeout.
23 # * I dunno - there must be other problems with this.
29 -re "(.*)\n(.*)\n" { set oldpass "$expect_out(1,string)" ; set newpass "$expect_out(2,string)" }
34 set env(LC_ALL) "en_US"
38 -re "word:" { sleep 2; send "$oldpass\n" }
44 -re "nvalid" { exit 1 }
45 -re "word:" { sleep 2; send "$newpass\n" }
51 -re "nvalid" { exit 1 }
52 -re "NVALID" { exit 1 }
53 -re "bad pass" { exit 1 }
54 -re "BAD PASS" { exit 1 }
55 -re "dictionary" { exit 1 }
56 -re "common" { exit 1 }
57 -re "short" { exit 1 }
58 -re "word:" { sleep 2; send "$newpass\n" }
64 -re "nvalid" { exit 1 }
65 -re "nchange" { exit 1 }