Handle hostnames with upper-case letters
[webmin.git] / pam / edit_inc.cgi
1 #!/usr/local/bin/perl
2 # Edit a PAM include for some service
3
4 require './pam-lib.pl';
5 &ReadParse();
6
7 @pam = &get_pam_config();
8 $pam = $pam[$in{'idx'}];
9 if ($in{'midx'} ne '') {
10         $mod = $pam->{'mods'}->[$in{'midx'}];
11         $inc = $mod->{'module'};
12         $type = $mod->{'type'};
13         &ui_print_header(undef, $text{'inc_edit'}, "");
14         }
15 else {
16         &ui_print_header(undef, $text{'inc_create'}, "");
17         $type = $in{'type'};
18         }
19
20
21 print &ui_form_start("save_inc.cgi");
22 print &ui_hidden("idx", $in{'idx'});
23 print &ui_hidden("midx", $in{'midx'});
24 print &ui_hidden("_type", $in{'type'});
25 print &ui_table_start($text{'inc_header'}, undef, 2, [ "width=30%" ]);
26
27 # PAM service name
28 $t = $text{'desc_'.$pam->{'name'}};
29 print &ui_table_row($text{'mod_name'},
30                     "<tt>".&html_escape($pam->{'name'})."</tt> ".
31                     ($pam->{'desc'} ? "($pam->{'desc'})" : $t ? "($t)" : ""));
32
33 # Authentication step
34 print &ui_table_row($text{'mod_type'},
35                     $text{'mod_type_'.$type});
36
37 # Included service
38 @pam = sort { $a->{'name'} cmp $b->{'name'} } @pam;
39 print &ui_table_row($text{'inc_inc'},
40     &ui_select("inc", $inc,
41         [ map { [ $_->{'name'},
42                   $_->{'name'}.($text{'desc_'.$_->{'name'}} ?
43                                 " (".$text{'desc_'.$_->{'name'}}.")" : "") ] }
44               grep { $_->{'name'} ne $pam->{'name'} } @pam ],
45         1, 0, $inc ? 1 : 0));
46
47 print &ui_table_end();
48
49 if ($in{'midx'} ne '') {
50         print &ui_form_end([ [ undef, $text{'save'} ],
51                              [ 'delete', $text{'delete'} ] ]);
52         }
53 else {
54         print &ui_form_end([ [ undef, $text{'create'} ] ]);
55         }
56
57 &ui_print_footer("edit_pam.cgi?idx=$in{'idx'}", $text{'edit_return'},
58                  "", $text{'index_return'});
59