use FS::Conf;
use FS::Record qw( qsearch qsearchs fields dbh );
use FS::svc_Common;
-use Net::SSH qw(ssh);
+use Net::SSH;
use FS::part_svc;
use FS::svc_acct_pop;
use FS::svc_acct_sm;
$self->shell,
);
if ( $username && $uid && $dir && $shellmachine && ! $nossh_hack ) {
- my $queue = new FS::queue { 'job' => 'Net::SSH::ssh' };
+ my $queue = new FS::queue { 'job' => 'FS::svc_acct::ssh' };
$error = $queue->insert("root\@$shellmachine", eval qq("$useradd") );
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
$self->dir,
);
if ( $username && $shellmachine && ! $nossh_hack ) {
- my $queue = new FS::queue { 'job' => 'Net::SSH::ssh' };
+ my $queue = new FS::queue { 'job' => 'FS::svc_acct::ssh' };
$error = $queue->insert("root\@$shellmachine", eval qq("$userdel") );
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
$new->getfield('gid'),
);
if ( $old_dir && $new_dir && $old_dir ne $new_dir && ! $nossh_hack ) {
- my $queue = new FS::queue { 'job' => 'Net::SSH::ssh' };
+ my $queue = new FS::queue { 'job' => 'FS::svc_acct::ssh' };
$error = $queue->insert("root\@$shellmachine", eval qq("$usermod") );
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
}
}
+ if ( $icradius_dbh ) {
+ my $queue = new FS::queue { 'job' => 'FS::svc_acct::icradius_rc_replace' };
+ $error = $queue->insert( $new->username,
+ $new->_password,
+ );
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return "queueing job (transaction rolled back): $error";
+ }
+ }
+
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
''; #no error
}
+sub icradius_rc_replace {
+ my( $username, $new_password ) = @_;
+
+ my $sth = $icradius_dbh->prepare(
+ "UPDATE radcheck SET Value = ? WHERE UserName = ? and Attribute = ?"
+ );
+ $sth->execute($new_password, $username, 'Password' )
+ or die "can't update radcheck table: ". $sth->errstr;
+
+ 1;
+}
+
=item suspend
Suspends this account by prefixing *SUSPENDED* to the password. If there is an
$self->username. '@'. $self->domain;
}
+=item ssh
+
+=cut
+
+sub ssh {
+ my ( $host, @cmd_and_args ) = @_;
+
+ use IO::File;
+ my $reader = IO::File->new();
+ my $writer = IO::File->new();
+ my $error = IO::file->new();
+
+ &Net::SSH::sshopen3( $host, $reader, $writer, $error, @cmd_and_args) or die $!;
+
+ local $/ = undef;
+ my $output_stream = <$writer>;
+ my $error_stream = <$error>;
+ if ( length $error_stream ) {
+ warn "[FS::svc_acct::ssh] STDERR $error_stream";
+ }
+ if ( length $output_stream ) {
+ warn "[FS::svc_acct::ssh] STDOUT $output_stream";
+ }
+
+# &Net::SSH::ssh(@args,">>/usr/local/etc/freeside/sshoutput 2>&1");
+}
+
=back
=head1 VERSION
-$Id: svc_acct.pm,v 1.40 2001-09-16 12:45:35 ivan Exp $
+$Id: svc_acct.pm,v 1.44 2001-09-19 19:39:24 ivan Exp $
=head1 BUGS