Re: change password CGI
I am currently using WebPass, which is a Perl script and Expect Script that allow password changes. I ran across it at
http://www.perl.com. Its a bit of a hack, but it works. I wouldn't mind a different solution, but for now this is working for me.
http://web.fccj.org/~wcjones/WebPass.html
Its not in the public domain exactly, but here is the liscense
# 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...
Wade Burgett
Burgett Systems
Mike Bennett wrote:
> On Mon, 8 Nov 1999, Chad A. Adlawan wrote:
>
> chadi > > >
> chadi > > > Does anyone have a CGI currently that I can use in apache ssl for users to
> chadi > > > change the password vire the WWW.
> chadi > > >
> chadi > > > I'm sure it's been done b4, so instead of re-inventing the wheel and
> chadi > > > writing it from scratch again, I thought I'd see if anyone has a CGI or
> chadi > > > php3 script that can do this already???
> chadi > >
> chadi > > Have you search in http://cgi.resourceindex.com/ ???
> chadi > >
> chadi > > --
> chadi >
> chadi >
> chadi > im interested in the same script myself, PHP3 preferred. i tried looking at cgi.resourceindex.com and didnt find anything.
> chadi > anybody has any suggestioons ?
>
> ----------snip---------------------------------------------------------
> /* Use poppassd to change passwords */
> /* Based upon a script for POP3 by Manuel Lemos (mlemos@acm.org) */
>
> class POPPASS
> {
> var $hostname="";
> var $port=106;
>
> /* Private variables - DO NOT ACCESS */
>
> var $connection=0;
> var $state="DISCONNECTED";
> var $greeting="";
> var $must_update=0;
>
> /* Private methods - DO NOT CALL */
>
> Function GetLine()
> {
> for($line="";;)
> {
> if(feof($this->connection))
> return(0);
> $line.=fgets($this->connection,100);
> $length=strlen($line);
> if($length>=2
> && substr($line,$length-2,2)=="\r\n")
> return(substr($line,0,$length-2));
> }
> }
>
> Function PutLine($line)
> {
> return(fputs($this->connection,"$line\r\n"));
> }
>
> Function OpenConnection()
> {
> if($this->hostname=="")
> return("2 it was not specified a valid hostname");
> switch(($this->connection=fsockopen($this->hostname,$this->port)))
> {
> case -3:
> return("-3 socket could not be created");
> case -4:
> return("-4 dns lookup on hostname \"$hostname\" failed");
> case -5:
> return("-5 connection refused or timed out");
> case -6:
> return("-6 fdopen() call failed");
> case -7:
> return("-7 setvbuf() call failed");
> default:
> return("");
> }
> }
>
> Function CloseConnection()
> {
> if($this->connection!=0)
> {
> fclose($this->connection);
> $this->connection=0;
> }
> }
>
> /* Public methods */
>
> /* NewPass method - Change the pasword */
>
> Function NewPass($server,$port,$user,$pass,$newpass) {
> $this->hostname = $server;
> $this->port = $port;
>
> if($this->state!="DISCONNECTED")
> return("1 a connection is already opened");
> if(($error=$this->OpenConnection())!="")
> return($error);
> $this->greeting=$this->GetLine();
> if(GetType($this->greeting)!="string"
> || strtok($this->greeting," ")!="200")
> {
> $this->CloseConnection();
> return("3 POPPASSD server greeting was not found");
> }
>
> if($this->PutLine("USER $user")==0)
> return("Could not send the USER command");
> $response=$this->GetLine();
> if(GetType($response)!="string")
> return("Could not get user login entry response");
> if(strtok($response," ")!="200")
> return("User error: ".strtok("\r\n"));
>
> if($this->PutLine("PASS $pass")==0)
> return("Could not send the PASS command");
> $response=$this->GetLine();
> if(GetType($response)!="string")
> return("Could not get password entry response");
> if(strtok($response," ")!="200")
> return("Password error: ".strtok("\r\n"));
>
> if($this->PutLine("NEWPASS $newpass")==0)
> return("Could not send the NEWPASS command");
> $response=$this->GetLine();
> if(GetType($response)!="string")
> return("Could not get new password entry response");
> if(strtok($response," ")!="200")
> return("New password error: ".strtok("\r\n"));
> }
>
> }
> ----------snip---------------------------------------------------------
>
> Install poppassd.
>
> Include the class above within your php program and then use:
>
> $p = new POPPASS;
> $p->NewPass("host.domain.com",106,"fred","oldpass","newpass");
>
> Thanks to Manuel Lemos for the original POP3 class that I modofied to
> create this. (You're welcome Andy)
>
> Hope this helps
> Cheers
> Mike
>
> --------------------------------------------------------------
> [ LiveWire ] 021-533820/06-3788206/Mike@LiveWire.gen.nz
> --------------------------------------------------------------
>
> --
> To UNSUBSCRIBE, email to debian-isp-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: