I am using the Expect module to talk to passwd and smbpasswd. (hmm..., how
original, right? :)
This particular script is run as root. I give it the username on the command
line and use Term::ReadKey to get the current password and the new password.
I am doing something similar for users to run and catch different strings,
but both scripts have the same trouble.
An EOF usually means that the original password could not be verified.
Catching "BAD PASSWORD" allows me to grep the reason for the error with
OBJECT->after().
Anyway, most of the time everything works well, however sometimes the script
just hangs (Expect waiting for passwd, I suppose) with "Waiting for new data
(unlimited seconds)..."
I stop the process and retry several times (using the same input) and it
will eventually work.
For passwd, I am catching:
#1: -re `BAD PASSWORD'
#2: -re `Changing password for'
#3: -re `Retype new password:'
#4: -re `passwd: all authentication tokens updated successfully'
#5: -eof `'
and for smbpasswd, I am catching:
#1: -re `New SMB password:'
#2: -re `Retype new SMB password:'
#3: -re `Password changed for user'
#4: -eof `'
Any ideas on where the intermittent hang might be coming from ?
Rob Walls
75 CS/SCBS
Hill AFB, Utah 84056
DSN 777-2230
COM (801) 777-2230
rob...@hi...
|