3 # Display a form for editing default options
5 require './xinetd-lib.pl';
6 &ui_print_header(undef, $text{'defs_title'}, "");
8 foreach $xi (&get_xinetd_config()) {
9 if ($xi->{'name'} eq 'defaults') {
13 $q = $defs->{'quick'};
15 print "<form action=save_defaults.cgi>\n";
16 print "<input type=hidden name=idx value='$defs->{'index'}'>\n";
17 print "<table border width=100%>\n";
18 print "<tr $tb> <td><b>$text{'defs_header'}</b></td> </tr>\n";
19 print "<tr $cb> <td><table width=100%>\n";
21 print "<tr> <td valign=top><b>$text{'serv_from'}</b></td>\n";
22 printf "<td><input type=radio name=from_def value=1 %s> %s\n",
23 $q->{'only_from'} ? '' : 'checked', $text{'serv_from_def'};
24 printf "<input type=radio name=from_def value=0 %s> %s<br>\n",
25 $q->{'only_from'} ? 'checked' : '', $text{'serv_from_sel'};
26 print "<textarea name=from rows=4 cols=20>",
27 join("\n", @{$q->{'only_from'}}),"</textarea></td>\n";
29 print "<td valign=top><b>$text{'serv_access'}</b></td>\n";
30 printf "<td><input type=radio name=access_def value=1 %s> %s\n",
31 $q->{'no_access'} ? '' : 'checked', $text{'serv_access_def'};
32 printf "<input type=radio name=access_def value=0 %s> %s<br>\n",
33 $q->{'no_access'} ? 'checked' : '', $text{'serv_access_sel'};
34 print "<textarea name=access rows=4 cols=20>",
35 join("\n", @{$q->{'no_access'}}),"</textarea></td> </tr>\n";
37 print "<tr> <td colspan=4><hr></td> </tr>\n";
39 $lt = $q->{'log_type'}->[0] eq 'SYSLOG' ? 1 :
40 $q->{'log_type'}->[0] eq 'FILE' ? 2 : 0;
41 print "<tr> <td valign=top><b>$text{'defs_log'}</b></td> <td colspan=3>\n";
42 printf "<input type=radio name=log_mode value=0 %s> %s<br>\n",
43 $lt == 0 ? 'checked' : '', $text{'defs_log_def'};
45 printf "<input type=radio name=log_mode value=1 %s> %s\n",
46 $lt == 1 ? 'checked' : '', $text{'defs_facility'};
47 %sconfig = &foreign_config("syslog");
48 &foreign_require("syslog", "syslog-lib.pl");
49 print "<select name=facility>\n";
50 foreach $f (split(/\s+/, $sconfig{'facilities'})) {
51 printf "<option %s>%s\n",
52 $lt == 1 && $q->{'log_type'}->[1] eq $f ? 'selected' : '', $f;
54 print "</select> $text{'defs_level'}\n";
55 print "<select name=level>\n";
56 printf "<option value='' %s>%s\n",
57 $lt != 1 || !$q->{'log_type'}->[2] ? 'selected' : '', $text{'default'};
58 foreach $l (&foreign_call("syslog", "list_priorities")) {
59 printf "<option %s>%s\n",
60 $lt == 1 && $q->{'log_type'}->[2] eq $l ? 'selected' : '', $l;
62 print "</select><br>\n";
64 printf "<input type=radio name=log_mode value=2 %s> %s\n",
65 $lt == 2 ? 'checked' : '', $text{'defs_file'};
66 printf "<input name=file size=35 value='%s'> %s<br>\n",
67 $lt == 2 ? $q->{'log_type'}->[1] : '', &file_chooser_button("file");
68 printf " %s <input name=soft size=6 value='%s'>\n",
69 $text{'defs_soft'}, $lt == 2 ? $q->{'log_type'}->[2] : '';
70 printf " %s <input name=hard size=6 value='%s'></td> </tr>\n",
71 $text{'defs_hard'}, $lt == 2 ? $q->{'log_type'}->[3] : '';
73 print "<tr> <td valign=top><b>$text{'defs_success'}</b></td>\n";
74 print "<td><select name=success multiple size=5>\n";
75 foreach $s ('PID', 'HOST', 'USERID', 'EXIT', 'DURATION') {
76 printf "<option value=%s %s>%s\n",
77 $s, &indexof($s, @{$q->{'log_on_success'}})<0 ? '' : 'selected',
78 $text{"defs_success_".lc($s)};
80 print "</select></td>\n";
82 print "<td valign=top><b>$text{'defs_failure'}</b></td>\n";
83 print "<td><select name=failure multiple size=5>\n";
84 foreach $s ('HOST', 'USERID', 'ATTEMPT') {
85 printf "<option value=%s %s>%s\n",
86 $s, &indexof($s, @{$q->{'log_on_failure'}})<0 ? '' : 'selected',
87 $text{"defs_failure_".lc($s)};
89 print "</select></td> </tr>\n";
91 print "</table></td></tr></table>\n";
92 print "<input type=submit value='$text{'save'}'></form>\n";
94 &ui_print_footer("", $text{'index_return'});