#!/usr/bin/expect # # @(#) WebPass.expect 3.1 (beta) Dec. 15th, 1999 # Modified by Roger Huang # # @(#) WebPass.expect 3.0 (beta) Dec. 9th, 1998 # Copyright (C) 1997 William C. Jones, FCCJ Webmaster; All Rights Reserved... # # The information in this file is provided for the exclusive use of the # I/S Staff of Florida Community College at Jacksonville. Such users have # the right to use, modify, and incorporate this code into other products # for purposes authorized by the license agreement provided they include this # notice and the associated copyright notice with any such product. The # information in this file is provided "AS IS" without warranty. # Public Domain Notice - # Copyright Addendum: This code is not in the Public Domain. You are # granted a free license to use, modify, and/or incorporate this software # into your own projects, provided that the above copyright remains # intact and is included in any further software distributions. # If you redistribute this software - please send an e-mail to # webmaster@fccj.cc.fl.us outlining who you are, what version you # have, where you obtained your version, and where/how you are # distributing this version. Also, if you have modified the version # you plan on redistributing, include the changes as well... # Thx, # Bill :) # Purpose: Allow account holders to modify their own password... # # Provides an easy to use interface so that Students, Faculty, & # Staff would not be required to learn how to Telnet, etc... # # Usage: Executed by a required Perl 5 script (included) whenever # a User wishes to change their E-Mail 'passwd'. # # Input: Obtains UserID, Current Password, New Password (which # should have been passed by the WebPass.cgi Perl 5 script.) # # Output: Processed HTML/JavaScript (Netscape ready; would need IE 3.02a or # better to utilize correctly; runs OK under Lynx or PROFS 'Charlotte.') # The output reports whether it was successful, or what type of error # was detected (Bad Password, Wrong Acct, etc...) # #============================================================================= # (Unless otherwise noted, all code changes made by WCJ, FCCJ Webmaster...) # Project started Oct 1997 using Modified passwd.expect example; # (Expect was created by Don Libes of www.nist.gov) Expect can be obtained # at http://expect.nist.gov NOTE: The NIST will not provide support # for this WebPass.expect program. # # Many Thx to all who have contributed: # # Chris Bannister - chris.bannister@dowmil.co.uk # Junior Systems Administrator, Dowding & Mills Plc. # Tel: +44 (0)121 766 6161 Fax: +44 (0)121 766 5948 # # For the DEBIAN 2.0 (Hamm release) portion of this script :] # # # Daniele ALBRIZIO albrizio@univ.trieste.it - Web Management # UNIVERSITY OF TRIESTE - Computing Center # via Valerio, 12 I-34100 Trieste Italy Tel. +39-040.6763337 # # For the AIX 4.3.1 portion of this script :] #============================================================================= # Output the HTTP Header, or Server will hate us... puts "Content-type: text/html\n\n" #............................................................................ puts "" puts "" puts "" puts "ADI Corp" puts " " puts " " puts "" puts "" # End of fccj Header subroutine... puts "

誠安電腦 線上修改密碼 WebPass


"; puts "

= 處理中 =

"; puts "
" puts " 處理狀態:
" set userid [lindex $argv 0] set passwd [lindex $argv 1] set passNew [lindex $argv 2] set passAgain [lindex $argv 3] # LINUX RedHat 6.0 spawn /bin/su $userid "-c /usr/bin/passwd" expect -re "^Password: $" send "$passwd\r" expect -re ".*(current) UNIX password: $" send "$passwd\r" expect -re "^New UNIX password: $" send "$passNew\r" expect -re "^Retype new UNIX password: $" send "$passAgain\r" expect -re "^passwd\: all authentication tokens updated successfully$" # End of LINUX Area... (NOTE: The previous (10th) line is NOT used...) #expect eof puts "
" # Lean and Mean... Item list for future enhancements; # # 1. No further updates. I am working on a 'Perl Only' # Solution using the Expect.pm (perl module...) # # 2. It seems that Linux RedHat 5.0 (Hurricane) is very # picky about where the tokens are 'seen' via a spawn; so # to achieve the intended results I researched using the # '-re' option for each 'expect' statement. It is # apparently working now...