session monitor updates
[freeside.git] / FS / FS / svc_acct.pm
index 5986bff..d2e3918 100644 (file)
@@ -12,6 +12,7 @@ use FS::svc_Common;
 use FS::SSH qw(ssh);
 use FS::part_svc;
 use FS::svc_acct_pop;
+use FS::svc_acct_sm;
 
 @ISA = qw( FS::svc_Common );
 
@@ -187,7 +188,7 @@ sub insert {
     $self->shell,
   );
   if ( $username && $uid && $dir && $shellmachine && ! $nossh_hack ) {
-    ssh("root\@$shellmachine", eval "$useradd");
+    ssh("root\@$shellmachine", eval qq("$useradd") );
   }
 
   ''; #no error
@@ -223,6 +224,9 @@ sub delete {
   my $self = shift;
   my $error;
 
+  return "Can't delete an account which has mail aliases pointed to it!"
+    if $self->uid && qsearch( 'svc_acct_sm', { 'domuid' => $self->uid } );
+
   local $SIG{HUP} = 'IGNORE';
   local $SIG{INT} = 'IGNORE';
   local $SIG{QUIT} = 'IGNORE';
@@ -238,7 +242,7 @@ sub delete {
     $self->dir,
   );
   if ( $username && $shellmachine && ! $nossh_hack ) {
-    ssh("root\@$shellmachine", eval "$userdel");
+    ssh("root\@$shellmachine", eval qq("$userdel") );
   }
 
   '';
@@ -300,7 +304,7 @@ sub replace {
     $new->getfield('gid'),
   );
   if ( $old_dir && $new_dir && $old_dir ne $new_dir && ! $nossh_hack ) {
-    ssh("root\@$shellmachine", eval "$usermod" );
+    ssh("root\@$shellmachine", eval qq("$usermod") );
   }
 
   ''; #no error
@@ -532,7 +536,7 @@ sub radius_check {
 
 =head1 VERSION
 
-$Id: svc_acct.pm,v 1.11 2000-07-17 10:37:27 ivan Exp $
+$Id: svc_acct.pm,v 1.13 2000-07-17 13:51:07 ivan Exp $
 
 =head1 BUGS