-# dispatch subroutines (should live elsewhere eventually)
-###
-
-sub passwd {
- #sleep 3;
- use FS::Record qw(qsearchs);
- use FS::svc_acct;
- #use FS::svc_domain;
-
- my $packet = shift;
-
- #my $domain = qsearchs('svc_domain', { 'domain' => $packet->{'domain'} } )
- # or return { error => "Domain $domain not found" };
-
- my $old_password = $packet->{'old_password'};
- my $new_password = $packet->{'new_password'};
- my $new_gecos = $packet->{'new_gecos'};
- my $new_shell = $packet->{'new_shell'};
-
- my $svc_acct =
- ( length($old_password) < 13
- && qsearchs( 'svc_acct', { 'username' => $packet->{'username'},
- #'domsvc' => $svc_domain->domsvc,
- '_password' => $old_password } )
- )
- || qsearchs( 'svc_acct', { 'username' => $packet->{'username'},
- #'domsvc' => $svc_domain->domsvc,
- '_password' => $old_password } );
-
- unless ( $svc_acct ) { return { error => 'Incorrect password.' } }
-
- my %hash = $svc_acct->hash;
- my $new_svc_acct = new FS::svc_acct ( \%hash );
- $new_svc_acct->setfield('_password', $new_password )
- if $new_password && $new_password ne $old_password;
- $new_svc_acct->setfield('finger',$new_gecos) if $new_gecos;
- $new_svc_acct->setfield('shell',$new_shell) if $new_shell;
- my $error = $new_svc_acct->replace($svc_acct);
-
- return { error => $error };
-
-}
-
-###