4 use vars qw( @ISA $nossh_hack $conf $dir_prefix @shells $usernamemin
5 $usernamemax $passwordmin $username_letter $username_letterfirst
7 $shellmachine $useradd $usermod $userdel $mydomain
8 $cyrus_server $cyrus_admin_user $cyrus_admin_pass
14 use FS::Record qw( qsearch qsearchs fields dbh );
20 use FS::cust_main_invoice;
25 @ISA = qw( FS::svc_Common );
27 #ask FS::UID to run this stuff for us later
28 $FS::UID::callback{'FS::svc_acct'} = sub {
30 $dir_prefix = $conf->config('home');
31 @shells = $conf->config('shells');
32 $shellmachine = $conf->config('shellmachine');
33 $usernamemin = $conf->config('usernamemin') || 2;
34 $usernamemax = $conf->config('usernamemax');
35 $passwordmin = $conf->config('passwordmin') || 6;
36 if ( $shellmachine ) {
37 if ( $conf->exists('shellmachine-useradd') ) {
38 $useradd = join("\n", $conf->config('shellmachine-useradd') )
39 || 'cp -pr /etc/skel $dir; chown -R $uid.$gid $dir';
41 $useradd = 'useradd -d $dir -m -s $shell -u $uid $username';
43 if ( $conf->exists('shellmachine-userdel') ) {
44 $userdel = join("\n", $conf->config('shellmachine-userdel') )
47 $userdel = 'userdel $username';
49 $usermod = join("\n", $conf->config('shellmachine-usermod') )
50 || '[ -d $old_dir ] && mv $old_dir $new_dir || ( '.
51 'chmod u+t $old_dir; mkdir $new_dir; cd $old_dir; '.
52 'find . -depth -print | cpio -pdm $new_dir; '.
53 'chmod u-t $new_dir; chown -R $uid.$gid $new_dir; '.
57 $username_letter = $conf->exists('username-letter');
58 $username_letterfirst = $conf->exists('username-letterfirst');
59 $username_noperiod = $conf->exists('username-noperiod');
60 $mydomain = $conf->config('domain');
61 if ( $conf->exists('cyrus') ) {
62 ($cyrus_server, $cyrus_admin_user, $cyrus_admin_pass) =
63 $conf->config('cyrus');
64 eval "use Cyrus::IMAP::Admin;"
67 $cyrus_admin_user = '';
68 $cyrus_admin_pass = '';
70 if ( $conf->exists('icradius_secrets') ) {
71 $icradius_dbh = DBI->connect($conf->config('icradius_secrets'))
76 $dirhash = $conf->config('dirhash') || 0;
79 @saltset = ( 'a'..'z' , 'A'..'Z' , '0'..'9' , '.' , '/' );
80 @pw_set = ( 'a'..'z', 'A'..'Z', '0'..'9', '(', ')', '#', '!', '.', ',' );
82 #not needed in 5.004 #srand($$|time);
86 FS::svc_acct - Object methods for svc_acct records
92 $record = new FS::svc_acct \%hash;
93 $record = new FS::svc_acct { 'column' => 'value' };
95 $error = $record->insert;
97 $error = $new_record->replace($old_record);
99 $error = $record->delete;
101 $error = $record->check;
103 $error = $record->suspend;
105 $error = $record->unsuspend;
107 $error = $record->cancel;
109 %hash = $record->radius;
111 %hash = $record->radius_reply;
113 %hash = $record->radius_check;
117 An FS::svc_acct object represents an account. FS::svc_acct inherits from
118 FS::svc_Common. The following fields are currently supported:
122 =item svcnum - primary key (assigned automatcially for new accounts)
126 =item _password - generated if blank
128 =item popnum - Point of presence (see L<FS::svc_acct_pop>)
136 =item dir - set automatically if blank (and uid is not)
140 =item quota - (unimplementd)
142 =item slipip - IP address
146 =item domsvc - svcnum from svc_domain
148 =item radius_I<Radius_Attribute> - I<Radius-Attribute>
150 =item domsvc - service number of svc_domain with which to associate
160 Creates a new account. To add the account to the database, see L<"insert">.
164 sub table { 'svc_acct'; }
168 Adds this account to the database. If there is an error, returns the error,
169 otherwise returns false.
171 The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be
172 defined. An FS::cust_svc record will be created and inserted.
174 If the configuration value (see L<FS::Conf>) shellmachine exists, and the
175 username, uid, and dir fields are defined, the command(s) specified in
176 the shellmachine-useradd configuration are added to the job queue (see
177 L<FS::queue> and L<freeside-queued>) to be exectued on shellmachine via ssh.
178 This behaviour can be surpressed by setting $FS::svc_acct::nossh_hack true.
179 If the shellmachine-useradd configuration file does not exist,
181 useradd -d $dir -m -s $shell -u $uid $username
183 is the default. If the shellmachine-useradd configuration file exists but
186 cp -pr /etc/skel $dir; chown -R $uid.$gid $dir
188 is the default instead. Otherwise the contents of the file are treated as
189 a double-quoted perl string, with the following variables available:
190 $username, $uid, $gid, $dir, and $shell.
192 (TODOC: cyrus config file, L<FS::queue> and L<freeside-queued>)
200 local $SIG{HUP} = 'IGNORE';
201 local $SIG{INT} = 'IGNORE';
202 local $SIG{QUIT} = 'IGNORE';
203 local $SIG{TERM} = 'IGNORE';
204 local $SIG{TSTP} = 'IGNORE';
205 local $SIG{PIPE} = 'IGNORE';
207 my $oldAutoCommit = $FS::UID::AutoCommit;
208 local $FS::UID::AutoCommit = 0;
213 $error = $self->check;
214 return $error if $error;
216 return "Username ". $self->username. " in use"
217 if qsearchs( 'svc_acct', { 'username' => $self->username,
218 'domsvc' => $self->domsvc,
221 my $part_svc = qsearchs( 'part_svc', { 'svcpart' => $self->svcpart } );
222 return "Unknown svcpart" unless $part_svc;
224 if $part_svc->part_svc_column('uid')->columnflag ne 'F'
225 && qsearchs( 'svc_acct', { 'uid' => $self->uid } )
226 && $self->username !~ /^(hyla)?fax$/
229 $error = $self->SUPER::insert;
231 $dbh->rollback if $oldAutoCommit;
235 my( $username, $uid, $gid, $dir, $shell ) = (
242 if ( $username && $uid && $dir && $shellmachine && ! $nossh_hack ) {
243 my $queue = new FS::queue { 'job' => 'FS::svc_acct::ssh' };
244 $error = $queue->insert("root\@$shellmachine", eval qq("$useradd") );
246 $dbh->rollback if $oldAutoCommit;
247 return "queueing job (transaction rolled back): $error";
251 if ( $cyrus_server ) {
252 my $queue = new FS::queue { 'job' => 'FS::svc_acct::cyrus_insert' };
253 $error = $queue->insert($self->username, $self->quota);
255 $dbh->rollback if $oldAutoCommit;
256 return "queueing job (transaction rolled back): $error";
259 if ( $icradius_dbh ) {
260 my $queue = new FS::queue { 'job' => 'FS::svc_acct::icradius_rc_insert' };
261 $error = $queue->insert( $self->username,
266 $dbh->rollback if $oldAutoCommit;
267 return "queueing job (transaction rolled back): $error";
271 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
276 my( $username, $quota ) = @_;
278 warn "cyrus_insert: starting for user $username, quota $quota\n";
280 warn "cyrus_insert: connecting to $cyrus_server\n";
281 my $client = Cyrus::IMAP::Admin->new($cyrus_server);
283 warn "cyrus_insert: authentication as $cyrus_admin_user\n";
284 $client->authenticate(
285 -user => $cyrus_admin_user,
286 -mechanism => "login",
287 -password => $cyrus_admin_pass
290 warn "cyrus_insert: creating user.$username\n";
291 my $rc = $client->create("user.$username");
292 my $error = $client->error;
293 die "cyrus_insert: error creating user.$username: $error" if $error;
295 warn "cyrus_insert: setacl user.$username, $username => all\n";
296 $rc = $client->setacl("user.$username", $username => 'all' );
297 $error = $client->error;
298 die "cyrus_insert: error setacl user.$username: $error" if $error;
301 warn "cyrus_insert: setquota user.$username, STORAGE => $quota\n";
302 $rc = $client->setquota("user.$username", 'STORAGE' => $quota );
303 $error = $client->error;
304 die "cyrus_insert: error setquota user.$username: $error" if $error;
310 sub icradius_rc_insert {
311 my( $username, $password, %radcheck ) = @_;
313 my $sth = $icradius_dbh->prepare(
314 "INSERT INTO radcheck ( id, UserName, Attribute, Value ) VALUES ( ".
315 join(", ", map { $icradius_dbh->quote($_) } (
322 $sth->execute or die "can't insert into radcheck table: ". $sth->errstr;
324 foreach my $attribute ( keys %radcheck ) {
325 my $sth = $icradius_dbh->prepare(
326 "INSERT INTO radcheck ( id, UserName, Attribute, Value ) VALUES ( ".
327 join(", ", map { $icradius_dbh->quote($_) } (
331 $radcheck{$attribute},
334 $sth->execute or die "can't insert into radcheck table: ". $sth->errstr;
342 Deletes this account from the database. If there is an error, returns the
343 error, otherwise returns false.
345 The corresponding FS::cust_svc record will be deleted as well.
347 If the configuration value (see L<FS::Conf>) shellmachine exists, the
348 command(s) specified in the shellmachine-userdel configuration file are
349 added to the job queue (see L<FS::queue> and L<freeside-queued>) to be executed
350 on shellmachine via ssh. This behavior can be surpressed by setting
351 $FS::svc_acct::nossh_hack true. If the shellmachine-userdel configuration
356 is the default. If the shellmachine-userdel configuration file exists but
361 is the default instead. Otherwise the contents of the file are treated as a
362 double-quoted perl string, with the following variables available:
365 (TODOC: cyrus config file)
372 if ( defined( $FS::Record::dbdef->table('svc_acct_sm') ) ) {
373 return "Can't delete an account which has (svc_acct_sm) mail aliases!"
374 if $self->uid && qsearch( 'svc_acct_sm', { 'domuid' => $self->uid } );
377 return "Can't delete an account which is a (svc_forward) source!"
378 if qsearch( 'svc_forward', { 'srcsvc' => $self->svcnum } );
380 return "Can't delete an account which is a (svc_forward) destination!"
381 if qsearch( 'svc_forward', { 'dstsvc' => $self->svcnum } );
383 return "Can't delete an account with (svc_www) web service!"
384 if qsearch( 'svc_www', { 'usersvc' => $self->usersvc } );
386 # what about records in session ?
388 local $SIG{HUP} = 'IGNORE';
389 local $SIG{INT} = 'IGNORE';
390 local $SIG{QUIT} = 'IGNORE';
391 local $SIG{TERM} = 'IGNORE';
392 local $SIG{TSTP} = 'IGNORE';
393 local $SIG{PIPE} = 'IGNORE';
395 my $oldAutoCommit = $FS::UID::AutoCommit;
396 local $FS::UID::AutoCommit = 0;
399 foreach my $cust_main_invoice (
400 qsearch( 'cust_main_invoice', { 'dest' => $self->svcnum } )
402 #next unless defined; #wtf is up with qsearch?
403 warn $cust_main_invoice;
404 next unless defined $cust_main_invoice;
405 my %hash = $cust_main_invoice->hash;
406 $hash{'dest'} = $self->email;
407 my $new = new FS::cust_main_invoice \%hash;
408 my $error = $new->replace($cust_main_invoice);
410 $dbh->rollback if $oldAutoCommit;
415 foreach my $svc_domain (
416 qsearch( 'svc_domain', { 'catchall' => $self->svcnum } )
418 my %hash = new FS::svc_domain->hash;
419 $hash{'catchall'} = '';
420 my $new = new FS::svc_domain \%hash;
421 my $error = $new->replace($svc_domain);
423 $dbh->rollback if $oldAutoCommit;
428 my $error = $self->SUPER::delete;
430 $dbh->rollback if $oldAutoCommit;
434 my( $username, $dir ) = (
438 if ( $username && $shellmachine && ! $nossh_hack ) {
439 my $queue = new FS::queue { 'job' => 'FS::svc_acct::ssh' };
440 $error = $queue->insert("root\@$shellmachine", eval qq("$userdel") );
442 $dbh->rollback if $oldAutoCommit;
443 return "queueing job (transaction rolled back): $error";
448 if ( $cyrus_server ) {
449 my $queue = new FS::queue { 'job' => 'FS::svc_acct::cyrus_delete' };
450 $error = $queue->insert($self->username);
452 $dbh->rollback if $oldAutoCommit;
453 return "queueing job (transaction rolled back): $error";
456 if ( $icradius_dbh ) {
457 my $queue = new FS::queue { 'job' => 'FS::svc_acct::icradius_rc_delete' };
458 $error = $queue->insert( $self->username );
460 $dbh->rollback if $oldAutoCommit;
461 return "queueing job (transaction rolled back): $error";
465 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
470 my $username = shift;
472 my $client = Cyrus::IMAP::Admin->new($cyrus_server);
473 $client->authenticate(
474 -user => $cyrus_admin_user,
475 -mechanism => "login",
476 -password => $cyrus_admin_pass
479 my $rc = $client->setacl("user.$username", $cyrus_admin_user => 'all' );
480 my $error = $client->error;
481 die $error if $error;
483 $rc = $client->delete("user.$username");
484 $error = $client->error;
485 die $error if $error;
490 sub icradius_rc_delete {
491 my $username = shift;
493 my $sth = $icradius_dbh->prepare(
494 'DELETE FROM radcheck WHERE UserName = ?'
496 $sth->execute($username)
497 or die "can't delete from radcheck table: ". $sth->errstr;
502 =item replace OLD_RECORD
504 Replaces OLD_RECORD with this one in the database. If there is an error,
505 returns the error, otherwise returns false.
507 If the configuration value (see L<FS::Conf>) shellmachine exists, and the
508 dir field has changed, the command(s) specified in the shellmachine-usermod
509 configuraiton file are added to the job queue (see L<FS::queue> and
510 L<freeside-queued>) to be executed on shellmachine via ssh. This behavior can
511 be surpressed by setting $FS::svc-acct::nossh_hack true. If the
512 shellmachine-userdel configuration file does not exist or is empty,
514 [ -d $old_dir ] && mv $old_dir $new_dir || (
518 find . -depth -print | cpio -pdm $new_dir;
520 chown -R $uid.$gid $new_dir;
524 is the default. This behaviour can be surpressed by setting
525 $FS::svc_acct::nossh_hack true.
530 my ( $new, $old ) = ( shift, shift );
533 return "Username in use"
534 if $old->username ne $new->username &&
535 qsearchs( 'svc_acct', { 'username' => $new->username } );
537 return "Can't change uid!" if $old->uid != $new->uid;
539 return "can't change username using Cyrus"
540 if $cyrus_server && $old->username ne $new->username;
542 #change homdir when we change username
543 $new->setfield('dir', '') if $old->username ne $new->username;
545 local $SIG{HUP} = 'IGNORE';
546 local $SIG{INT} = 'IGNORE';
547 local $SIG{QUIT} = 'IGNORE';
548 local $SIG{TERM} = 'IGNORE';
549 local $SIG{TSTP} = 'IGNORE';
550 local $SIG{PIPE} = 'IGNORE';
552 my $oldAutoCommit = $FS::UID::AutoCommit;
553 local $FS::UID::AutoCommit = 0;
556 $error = $new->SUPER::replace($old);
558 $dbh->rollback if $oldAutoCommit;
559 return $error if $error;
562 my ( $old_dir, $new_dir, $uid, $gid ) = (
563 $old->getfield('dir'),
564 $new->getfield('dir'),
565 $new->getfield('uid'),
566 $new->getfield('gid'),
568 if ( $old_dir && $new_dir && $old_dir ne $new_dir && ! $nossh_hack ) {
569 my $queue = new FS::queue { 'job' => 'FS::svc_acct::ssh' };
570 $error = $queue->insert("root\@$shellmachine", eval qq("$usermod") );
572 $dbh->rollback if $oldAutoCommit;
573 return "queueing job (transaction rolled back): $error";
577 if ( $icradius_dbh ) {
578 my $queue = new FS::queue { 'job' => 'FS::svc_acct::icradius_rc_replace' };
579 $error = $queue->insert( $new->username,
583 $dbh->rollback if $oldAutoCommit;
584 return "queueing job (transaction rolled back): $error";
588 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
592 sub icradius_rc_replace {
593 my( $username, $new_password ) = @_;
595 my $sth = $icradius_dbh->prepare(
596 "UPDATE radcheck SET Value = ? WHERE UserName = ? and Attribute = ?"
598 $sth->execute($new_password, $username, 'Password' )
599 or die "can't update radcheck table: ". $sth->errstr;
606 Suspends this account by prefixing *SUSPENDED* to the password. If there is an
607 error, returns the error, otherwise returns false.
609 Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
615 my %hash = $self->hash;
616 unless ( $hash{_password} =~ /^\*SUSPENDED\* / ) {
617 $hash{_password} = '*SUSPENDED* '.$hash{_password};
618 my $new = new FS::svc_acct ( \%hash );
619 $new->replace($self);
621 ''; #no error (already suspended)
627 Unsuspends this account by removing *SUSPENDED* from the password. If there is
628 an error, returns the error, otherwise returns false.
630 Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
636 my %hash = $self->hash;
637 if ( $hash{_password} =~ /^\*SUSPENDED\* (.*)$/ ) {
638 $hash{_password} = $1;
639 my $new = new FS::svc_acct ( \%hash );
640 $new->replace($self);
642 ''; #no error (already unsuspended)
648 Just returns false (no error) for now.
650 Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
654 Checks all fields to make sure this is a valid service. If there is an error,
655 returns the error, otherwise returns false. Called by the insert and replace
658 Sets any fixed values; see L<FS::part_svc>.
665 my($recref) = $self->hashref;
667 my $x = $self->setfixed;
668 return $x unless ref($x);
671 my $error = $self->ut_numbern('svcnum')
672 || $self->ut_number('domsvc')
674 return $error if $error;
676 my $ulen = $usernamemax || $self->dbdef_table->column('username')->length;
677 $recref->{username} =~ /^([a-z0-9_\-\.]{$usernamemin,$ulen})$/
678 or return "Illegal username";
679 $recref->{username} = $1;
680 if ( $username_letterfirst ) {
681 $recref->{username} =~ /^[a-z]/ or return "Illegal username";
682 } elsif ( $username_letter ) {
683 $recref->{username} =~ /[a-z]/ or return "Illegal username";
685 if ( $username_noperiod ) {
686 $recref->{username} =~ /\./ and return "Illegal username";
689 $recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum: ".$recref->{popnum};
690 $recref->{popnum} = $1;
691 return "Unknown popnum" unless
692 ! $recref->{popnum} ||
693 qsearchs('svc_acct_pop',{'popnum'=> $recref->{popnum} } );
695 unless ( $part_svc->part_svc_column('uid')->columnflag eq 'F' ) {
697 $recref->{uid} =~ /^(\d*)$/ or return "Illegal uid";
698 $recref->{uid} = $1 eq '' ? $self->unique('uid') : $1;
700 $recref->{gid} =~ /^(\d*)$/ or return "Illegal gid";
701 $recref->{gid} = $1 eq '' ? $recref->{uid} : $1;
702 #not all systems use gid=uid
703 #you can set a fixed gid in part_svc
705 return "Only root can have uid 0"
706 if $recref->{uid} == 0 && $recref->{username} ne 'root';
708 $error = $self->ut_textn('finger');
709 return $error if $error;
711 $recref->{dir} =~ /^([\/\w\-]*)$/
712 or return "Illegal directory";
714 unless ( $recref->{dir} ) {
715 $recref->{dir} = $dir_prefix . '/';
716 if ( $dirhash > 0 ) {
717 for my $h ( 1 .. $dirhash ) {
718 $recref->{dir} .= substr($recref->{username}, $h-1, 1). '/';
720 } elsif ( $dirhash < 0 ) {
721 for my $h ( reverse $dirhash .. -1 ) {
722 $recref->{dir} .= substr($recref->{username}, $h, 1). '/';
725 $recref->{dir} .= $recref->{username};
729 unless ( $recref->{username} eq 'sync' ) {
730 if ( grep $_ eq $recref->{shell}, @shells ) {
731 $recref->{shell} = (grep $_ eq $recref->{shell}, @shells)[0];
733 return "Illegal shell \`". $self->shell. "\'; ".
734 $conf->dir. "/shells contains: @shells";
737 $recref->{shell} = '/bin/sync';
740 $recref->{quota} =~ /^(\d*)$/ or return "Illegal quota (unimplemented)";
741 $recref->{quota} = $1;
744 $recref->{gid} ne '' ?
745 return "Can't have gid without uid" : ( $recref->{gid}='' );
746 $recref->{finger} ne '' ?
747 return "Can't have finger-name without uid" : ( $recref->{finger}='' );
748 $recref->{dir} ne '' ?
749 return "Can't have directory without uid" : ( $recref->{dir}='' );
750 $recref->{shell} ne '' ?
751 return "Can't have shell without uid" : ( $recref->{shell}='' );
752 $recref->{quota} ne '' ?
753 return "Can't have quota without uid" : ( $recref->{quota}='' );
756 unless ( $part_svc->part_svc_column('slipip')->columnflag eq 'F' ) {
757 unless ( $recref->{slipip} eq '0e0' ) {
758 $recref->{slipip} =~ /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/
759 or return "Illegal slipip". $self->slipip;
760 $recref->{slipip} = $1;
762 $recref->{slipip} = '0e0';
767 #arbitrary RADIUS stuff; allow ut_textn for now
768 foreach ( grep /^radius_/, fields('svc_acct') ) {
772 #generate a password if it is blank
773 $recref->{_password} = join('',map($pw_set[ int(rand $#pw_set) ], (0..7) ) )
774 unless ( $recref->{_password} );
776 #if ( $recref->{_password} =~ /^((\*SUSPENDED\* )?)([^\t\n]{4,16})$/ ) {
777 if ( $recref->{_password} =~ /^((\*SUSPENDED\* )?)([^\t\n]{$passwordmin,8})$/ ) {
778 $recref->{_password} = $1.$3;
779 #uncomment this to encrypt password immediately upon entry, or run
780 #bin/crypt_pw in cron to give new users a window during which their
781 #password is available to techs, for faxing, etc. (also be aware of
783 #$recref->{password} = $1.
784 # crypt($3,$saltset[int(rand(64))].$saltset[int(rand(64))]
786 } elsif ( $recref->{_password} =~ /^((\*SUSPENDED\* )?)([\w\.\/\$]{13,34})$/ ) {
787 $recref->{_password} = $1.$3;
788 } elsif ( $recref->{_password} eq '*' ) {
789 $recref->{_password} = '*';
790 } elsif ( $recref->{_password} eq '!!' ) {
791 $recref->{_password} = '!!';
793 return "Illegal password";
801 Depriciated, use radius_reply instead.
806 carp "FS::svc_acct::radius depriciated, use radius_reply";
812 Returns key/value pairs, suitable for assigning to a hash, for any RADIUS
813 reply attributes of this record.
815 Note that this is now the preferred method for reading RADIUS attributes -
816 accessing the columns directly is discouraged, as the column names are
817 expected to change in the future.
825 my($column, $attrib) = ($1, $2);
826 #$attrib =~ s/_/\-/g;
827 ( $FS::raddb::attrib{lc($attrib)}, $self->getfield($column) );
828 } grep { /^radius_/ && $self->getfield($_) } fields( $self->table );
833 Returns key/value pairs, suitable for assigning to a hash, for any RADIUS
834 check attributes of this record.
836 Accessing RADIUS attributes directly is not supported and will break in the
845 my($column, $attrib) = ($1, $2);
846 #$attrib =~ s/_/\-/g;
847 ( $FS::raddb::attrib{lc($attrib)}, $self->getfield($column) );
848 } grep { /^rc_/ && $self->getfield($_) } fields( $self->table );
853 Returns the domain associated with this account.
859 if ( $self->domsvc ) {
860 my $svc_domain = qsearchs( 'svc_domain', { 'svcnum' => $self->domsvc } )
861 or die "no svc_domain.svcnum for svc_acct.domsvc ". $self->domsvc;
864 $mydomain or die "svc_acct.domsvc is null and no legacy domain config file";
870 Returns an email address associated with the account.
876 $self->username. '@'. $self->domain;
884 my ( $host, @cmd_and_args ) = @_;
887 my $reader = IO::File->new();
888 my $writer = IO::File->new();
889 my $error = IO::File->new();
891 &Net::SSH::sshopen3( $host, $reader, $writer, $error, @cmd_and_args) or die $!;
894 my $output_stream = <$writer>;
895 my $error_stream = <$error>;
896 if ( length $error_stream ) {
897 #warn "[FS::svc_acct::ssh] STDERR $error_stream";
898 die "[FS::svc_acct::ssh] STDERR $error_stream";
900 if ( length $output_stream ) {
901 warn "[FS::svc_acct::ssh] STDOUT $output_stream";
904 # &Net::SSH::ssh(@args,">>/usr/local/etc/freeside/sshoutput 2>&1");
911 $Id: svc_acct.pm,v 1.46 2001-09-19 21:06:17 ivan Exp $
915 The bits which ssh should fork before doing so (or maybe queue jobs for a
918 The $recref stuff in sub check should be cleaned up.
920 The suspend, unsuspend and cancel methods update the database, but not the
921 current object. This is probably a bug as it's unexpected and
926 L<FS::svc_Common>, L<FS::Record>, L<FS::Conf>, L<FS::cust_svc>,
927 L<FS::part_svc>, L<FS::cust_pkg>, L<FS::queue>, L<freeside-queued>),
928 L<Net::SSH>, L<ssh>, L<FS::svc_acct_pop>,
929 schema.html from the base documentation.