1# display args for pam_unix.so
2
3# display_args(&service, &module, &args)
4sub display_module_args
5{
6print &ui_table_row($text{'pwdb_shadow'},
7	&ui_yesno_radio("shadow", defined($_[2]->{'shadow'}) ? 1 : 0));
8
9print &ui_table_row($text{'pwdb_md5'},
10	&ui_yesno_radio("md5", defined($_[2]->{'md5'}) ? 1 : 0));
11
12print &ui_table_row($text{'pwdb_nullok'},
13	&ui_yesno_radio("nullok", defined($_[2]->{'nullok'}) ? 1 : 0));
14
15print &ui_table_row($text{'unix_nullok_secure'},
16	&ui_yesno_radio("nullok_secure",
17			defined($_[2]->{'nullok_secure'}) ? 1 : 0));
18
19if ($_[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)
33sub parse_module_args
34{
35if ($in{'nullok'}) { $_[2]->{'nullok'} = ""; }
36else { delete($_[2]->{'nullok'}); }
37
38if ($in{'nullok_secure'}) { $_[2]->{'nullok_secure'} = ""; }
39else { delete($_[2]->{'nullok_secure'}); }
40
41if ($in{'shadow'}) { $_[2]->{'shadow'} = ""; }
42else { delete($_[2]->{'shadow'}); }
43
44if ($in{'md5'}) { $_[2]->{'md5'} = ""; }
45else { delete($_[2]->{'md5'}); }
46
47if ($_[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}
68