freeside/fs_passwd fs_passwd.cgi,1.2,1.2.4.1
ivan
ivan at pouncequick.420.am
Fri Apr 9 15:29:40 PDT 2004
Update of /home/cvs/cvsroot/freeside/fs_passwd
In directory pouncequick:/tmp/cvs-serv24652
Modified Files:
Tag: FREESIDE_1_4_BRANCH
fs_passwd.cgi
Log Message:
add updated fs_passwd.cgi to 1.4 branch too
Index: fs_passwd.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_passwd/fs_passwd.cgi,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -d -r1.2 -r1.2.4.1
--- fs_passwd.cgi 26 Mar 2002 23:18:48 -0000 1.2
+++ fs_passwd.cgi 9 Apr 2004 22:29:37 -0000 1.2.4.1
@@ -2,12 +2,10 @@
use strict;
use Getopt::Std;
-use Socket;
-use IO::Handle;
+use FS::SelfService qw(passwd);
use CGI;
use CGI::Carp qw(fatalsToBrowser);
-my $fs_passwdd_socket = "/usr/local/freeside/fs_passwdd_socket";
my $freeside_uid = scalar(getpwnam('freeside'));
$ENV{'PATH'} ='/usr/local/bin:/usr/bin:/usr/ucb:/bin';
@@ -24,6 +22,9 @@
$cgi->param('username') =~ /^([^\n]{0,255}$)/ or die "Illegal username";
my $me = $1;
+$cgi->param('domain') =~ /^([^\n]{0,255}$)/ or die "Illegal domain";
+my $domain = $1;
+
$cgi->param('old_password') =~ /^([^\n]{0,255}$)/ or die "Illegal old_password";
my $old_password = $1;
@@ -33,12 +34,14 @@
die "New passwords don't match"
unless $new_password eq $cgi->param('new_password2');
-socket(SOCK, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!";
-connect(SOCK, sockaddr_un($fs_passwdd_socket)) or die "connect: $!";
-print SOCK join("\n", $me, $old_password, $new_password, '', ''), "\n";
-SOCK->flush;
-my $error = <SOCK>;
-chomp $error;
+my $rv = passwd(
+ 'username' => $me,
+ 'domain' => $domain,
+ 'old_password' => $old_password,
+ 'new_password' => $new_password,
+);
+
+my $error = $rv->{error};
if ($error) {
die $error;
More information about the freeside-commits
mailing list