shellcommands w/passwords
[freeside.git] / FS / FS / part_export.pm
index 7661d7e..20e3ab4 100644 (file)
@@ -494,25 +494,19 @@ sub export_info {
   my $r = { map { %{$exports{$_}} } keys %exports };
 }
 
-=item exporttype2svcdb EXPORTTYPE
-
-Returns the applicable I<svcdb> for an I<exporttype>.
-
-=cut
-
-# This subroutine should be modified or removed.  In its present form, it
-# imposes the arbitrary restriction that no export type can be associated 
-# with more than one svcdb.  The only place it's used is in edit/part_svc.cgi
-# to generate the list of allowed exports, which can be done more cleanly by 
-# export_info anyway.
-
-sub exporttype2svcdb {
-  my $exporttype = $_[0];
-  foreach my $svcdb ( keys %exports ) {
-    return $svcdb if grep { $exporttype eq $_ } keys %{$exports{$svcdb}};
-  }
-  '';
-}
+#=item exporttype2svcdb EXPORTTYPE
+#
+#Returns the applicable I<svcdb> for an I<exporttype>.
+#
+#=cut
+#
+#sub exporttype2svcdb {
+#  my $exporttype = $_[0];
+#  foreach my $svcdb ( keys %exports ) {
+#    return $svcdb if grep { $exporttype eq $_ } keys %{$exports{$svcdb}};
+#  }
+#  '';
+#}
 
 tie my %sysvshell_options, 'Tie::IxHash',
   'crypt' => { label=>'Password encryption',
@@ -532,21 +526,33 @@ tie my %shellcommands_options, 'Tie::IxHash',
   #'machine' => { label=>'Remote machine' },
   'user' => { label=>'Remote username', default=>'root' },
   'useradd' => { label=>'Insert command',
-                 default=>'useradd -d $dir -m -s $shell -u $uid $username'
+                 default=>'useradd -d $dir -m -s $shell -u $uid $username; passwd $username'
                 #default=>'cp -pr /etc/skel $dir; chown -R $uid.$gid $dir'
                },
+  'useradd_stdin' => { label=>'Insert command STDIN',
+                       type =>'textarea',
+                       default=>'$_password\n$_password\n',
+                     },
   'userdel' => { label=>'Delete command',
                  default=>'userdel $username',
                  #default=>'rm -rf $dir',
                },
+  'userdel_stdin' => { label=>'Delete command STDIN',
+                       type =>'textarea',
+                       default=>'',
+                     },
   'usermod' => { label=>'Modify command',
-                 default=>'usermod -d $new_dir -l $new_username -s $new_shell -u $new_uid $old_username',
+                 default=>'usermod -d $new_dir -l $new_username -s $new_shell -u $new_uid $old_username; passwd $new_username',
                 #default=>'[ -d $old_dir ] && mv $old_dir $new_dir || ( '.
                  #  'chmod u+t $old_dir; mkdir $new_dir; cd $old_dir; '.
                  #  'find . -depth -print | cpio -pdm $new_dir; '.
                  #  'chmod u-t $new_dir; chown -R $uid.$gid $new_dir; '.
                  #  'rm -rf $old_dir'.
                  #')'
+  'usermod_stdin' => { label=>'Modify command STDIN',
+                       type =>'textarea',
+                       default=>'$_password\n$_password\n',
+                     },
                },
 ;
 
@@ -615,14 +621,14 @@ tie my %sqlmail_options, 'Tie::IxHash',
         'Batch export of /etc/passwd and /etc/shadow files (Linux/SysV)',
       'options' => \%sysvshell_options,
       'nodomain' => 'Y',
-      'notes' => 'MD5 crypt requires installation of <a href="http://search.cpan.org/search?dist=Crypt-PasswdMD5">Crypt::PasswdMD5</a> from CPAN.',
+      'notes' => 'MD5 crypt requires installation of <a href="http://search.cpan.org/search?dist=Crypt-PasswdMD5">Crypt::PasswdMD5</a> from CPAN.  Run shell.export, etc.',
     },
     'bsdshell' => {
       'desc' =>
         'Batch export of /etc/passwd and /etc/master.passwd files (BSD)',
       'options' => \%bsdshell_options,
       'nodomain' => 'Y',
-      'notes' => 'MD5 crypt requires installation of <a href="http://search.cpan.org/search?dist=Crypt-PasswdMD5">Crypt::PasswdMD5</a> from CPAN.',
+      'notes' => 'MD5 crypt requires installation of <a href="http://search.cpan.org/search?dist=Crypt-PasswdMD5">Crypt::PasswdMD5</a> from CPAN.  Run shell.export, etc.',
     },
 #    'nis' => {
 #      'desc' =>