Handle hostnames with upper-case letters
[webmin.git] / pam / pam_unix.so.pl
1 # display args for pam_unix.so
2
3 # display_args(&service, &module, &args)
4 sub display_module_args
5 {
6 print &ui_table_row($text{'pwdb_shadow'},
7         &ui_yesno_radio("shadow", defined($_[2]->{'shadow'}) ? 1 : 0));
8
9 print &ui_table_row($text{'pwdb_md5'},
10         &ui_yesno_radio("md5", defined($_[2]->{'md5'}) ? 1 : 0));
11
12 print &ui_table_row($text{'pwdb_nullok'},
13         &ui_yesno_radio("nullok", defined($_[2]->{'nullok'}) ? 1 : 0));
14
15 print &ui_table_row($text{'unix_nullok_secure'},
16         &ui_yesno_radio("nullok_secure",
17                         defined($_[2]->{'nullok_secure'}) ? 1 : 0));
18
19 if ($_[1]->{'type'} eq 'password') {
20         # Password-change specific options
21         print &ui_table_row($text{'unix_min'},
22                 &ui_opt_textbox("min", $_[2]->{'min'}, 5, $text{'unix_nomin'}));
23
24         print &ui_table_row($text{'unix_max'},
25                 &ui_opt_textbox("max", $_[2]->{'max'}, 5, $text{'unix_nomax'}));
26
27         print &ui_table_row($text{'unix_obscure'},
28                 &ui_yesno_radio("obscure",defined($_[2]->{'obscure'}) ? 1 : 0));
29         }
30 }
31
32 # parse_module_args(&service, &module, &args)
33 sub parse_module_args
34 {
35 if ($in{'nullok'}) { $_[2]->{'nullok'} = ""; }
36 else { delete($_[2]->{'nullok'}); }
37
38 if ($in{'nullok_secure'}) { $_[2]->{'nullok_secure'} = ""; }
39 else { delete($_[2]->{'nullok_secure'}); }
40
41 if ($in{'shadow'}) { $_[2]->{'shadow'} = ""; }
42 else { delete($_[2]->{'shadow'}); }
43
44 if ($in{'md5'}) { $_[2]->{'md5'} = ""; }
45 else { delete($_[2]->{'md5'}); }
46
47 if ($_[1]->{'type'} eq 'password') {
48         if ($in{'min_def'}) {
49                 delete($_[2]->{'min'});
50                 }
51         else {
52                 $in{'min'} =~ /^\d+$/ || &error($text{'unix_emin'});
53                 $_[2]->{'min'} = $in{'min'};
54                 }
55
56         if ($in{'max_def'}) {
57                 delete($_[2]->{'max'});
58                 }
59         else {
60                 $in{'max'} =~ /^\d+$/ || &error($text{'unix_emax'});
61                 $_[2]->{'max'} = $in{'max'};
62                 }
63
64         if ($in{'obscure'}) { $_[2]->{'obscure'} = ""; }
65         else { delete($_[2]->{'obscure'}); }
66         }
67 }