1# display args for pam_listfile.so
2
3# display_args(&service, &module, &args)
4sub display_module_args
5{
6print &ui_table_row($text{'listfile_item'},
7	&ui_select("item", $_[2]->{'item'},
8		[ map { [ $_, $text{'listfile_item_'.$_} ] }
9		      ('user', 'tty', 'rhost', 'ruser', 'group', 'shell') ]));
10
11print &ui_table_row($text{'listfile_sense'},
12	&ui_radio("sense", $_[2]->{'sense'} || "deny",
13		[ [ "allow", $text{'listfile_succeed'} ],
14		  [ "deny", $text{'listfile_fail'} ] ]));
15
16print &ui_table_row($text{'listfile_file'},
17	&ui_textbox("file", $_[2]->{'file'}, 50)." ".
18	&file_chooser_button("file"), 3);
19
20print &ui_table_row($text{'listfile_onerr'},
21	&ui_radio("onerr", $_[2]->{'onerr'} || "succeed",
22		  [ [ "fail", $text{'listfile_fail'} ],
23		    [ "success", $text{'listfile_succeed'} ] ]));
24
25local $mode = $_[2]->{'apply'} =~ /^\@/ ? 2 :
26	      $_[2]->{'apply'} ? 1 : 0;
27print &ui_table_row($text{'listfile_apply'},
28    &ui_radio("apply_mode", $mode,
29	[ [ 0, $text{'listfile_all'} ],
30	  [ 1, $text{'listfile_user'}." ".
31	    &unix_user_input("apply_user", $mode == 1 ? $_[2]->{'apply'} : "")],
32	  [ 2, $text{'listfile_group'}." ".
33	    &unix_group_input("apply_group", $mode == 2 ?
34			substr($_[2]->{'apply'}, 1) : "") ] ]), 3);
35}
36
37# parse_module_args(&service, &module, &args)
38sub parse_module_args
39{
40$_[2]->{'item'} = $in{'item'};
41$_[2]->{'sense'} = $in{'sense'};
42$_[2]->{'file'} = $in{'file'};
43$_[2]->{'onerr'} = $in{'onerr'};
44if ($in{'apply_mode'} == 0) {
45	delete($_[2]->{'apply'});
46	}
47elsif ($in{'apply_mode'} == 1) {
48	$_[2]->{'apply'} = $in{'apply_user'};
49	}
50else {
51	$_[2]->{'apply'} = '@'.$in{'apply_group'};
52	}
53}
54