add crypt option to (bsd|sysv)shell export
authorivan <ivan>
Tue, 11 Jun 2002 08:29:09 +0000 (08:29 +0000)
committerivan <ivan>
Tue, 11 Jun 2002 08:29:09 +0000 (08:29 +0000)
FS/FS/part_export.pm
httemplate/edit/part_export.cgi

index bf60720..7661d7e 100644 (file)
@@ -514,6 +514,20 @@ sub exporttype2svcdb {
   '';
 }
 
+tie my %sysvshell_options, 'Tie::IxHash',
+  'crypt' => { label=>'Password encryption',
+               type=>'select', options=>[qw(crypt md5)],
+               default=>'crypt',
+             },
+;
+
+tie my %bsdshell_options, 'Tie::IxHash', 
+  'crypt' => { label=>'Password encryption',
+               type=>'select', options=>[qw(crypt md5)],
+               default=>'crypt',
+             },
+;
+
 tie my %shellcommands_options, 'Tie::IxHash',
   #'machine' => { label=>'Remote machine' },
   'user' => { label=>'Remote username', default=>'root' },
@@ -599,12 +613,16 @@ tie my %sqlmail_options, 'Tie::IxHash',
     'sysvshell' => {
       'desc' =>
         'Batch export of /etc/passwd and /etc/shadow files (Linux/SysV)',
-      'options' => {},
+      '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.',
     },
     'bsdshell' => {
       'desc' =>
         'Batch export of /etc/passwd and /etc/master.passwd files (BSD)',
-      'options' => {},
+      '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.',
     },
 #    'nis' => {
 #      'desc' =>
@@ -614,6 +632,7 @@ tie my %sqlmail_options, 'Tie::IxHash',
     'textradius' => {
       'desc' => 'Batch export of a text /etc/raddb/users file (Livingston, Cistron)',
       'options' => {},
+      'notes' => 'unfinished...',
     },
 
     'shellcommands' => {
@@ -634,8 +653,7 @@ tie my %sqlmail_options, 'Tie::IxHash',
       'desc' => 'Real-time export to SQL-backed mail server',
       'options' => \%sqlmail_options,
       'nodomain' => 'Y',
-      'notes' => 'Database schema can be made to work with Courier IMAP and
- Exim.  Others could work but are untested.',
+      'notes' => 'Database schema can be made to work with Courier IMAP and Exim.  Others could work but are untested.',
     },
 
     'cyrus' => {
index af89c4e..fbc698e 100644 (file)
@@ -45,15 +45,30 @@ my $widget = new HTML::Widgets::SelectLayers(
       if $layer;
 
     foreach my $option ( keys %{$exports->{$layer}{options}} ) {
-#    foreach my $option ( qw(url login password groupID ) ) {
       my $optinfo = $exports->{$layer}{options}{$option};
       my $label = $optinfo->{label};
+      my $type = defined($optinfo->{type}) ? $optinfo->{type} : 'text';
       my $value = $cgi->param($option)
                   || $part_export->option($option)
                   || (exists $optinfo->{default} ? $optinfo->{default} : '');
-      $html .= qq!<TR><TD ALIGN="right">$label</TD>!.
-               qq!<TD><INPUT TYPE="text" NAME="$option" VALUE="$value" SIZE=64></TD>!.
-               '</TR>';
+      $html .= qq!<TR><TD ALIGN="right">$label</TD><TD>!;
+      if ( $type eq 'select' ) {
+        $html .= qq!<SELECT NAME="$option">!;
+        foreach my $select_option ( @{$optinfo->{options}} ) {
+          #if ( ref($select_option) ) {
+          #} else {
+            $selected = $select_option eq $value ? ' SELECTED' : '';
+            $html .= qq!<OPTION VALUE="$select_option"$selected>!.
+                     qq!$select_option</OPTION>!;
+          #}
+        }
+        $html .= '</SELECT>';
+      } elsif ( $type eq 'text' ) {
+        $html .= qq!<INPUT TYPE="text" NAME="$option" VALUE="$value" SIZE=64>!;
+      } else {
+        $html .= "unknown type $type";
+      }
+      $html .= '</TD></TR>';
     }
     $html .= '</TABLE>';