File: list_opts.cgi

package info (click to toggle)
webmin-extra 1.180-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 12,324 kB
  • ctags: 1,200
  • sloc: perl: 39,117; makefile: 125
file content (184 lines) | stat: -rwxr-xr-x 7,057 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/usr/local/bin/perl
# list_opts.cgi
# A form for editing options set with the 'O foo=bar' directive,
# and other things.

require './sendmail-lib.pl';
$access{'opts'} || &error($text{'opts_ecannot'});
&ui_print_header(undef, $text{'opts_title'}, "");

$conf = &get_sendmailcf();
$default = $text{'opts_default'};
print "<form action=save_opts.cgi>\n";
print "<table border width=100%>\n";
print "<tr $tb> <td><b>$text{'opts_title'}</b></td></tr>\n";
print "<tr $cb> <td><table width=100%>\n";

($dsstr, $ds) = &find_type2("D", "S", $conf);
print "<tr> <td>",&hlink("<b>$text{'opts_ds'}</b>","opt_DS"),
      "</td> <td colspan=3>\n";
printf "<input type=radio name=DS_def value=1 %s> $text{'opts_direct'}\n",
	$ds ? "" : "checked";
printf "<input type=radio name=DS_def value=0 %s>\n",
	$ds ? "checked" : "";
print "<input name=DS size=25 value=\"$ds\"></td> </tr>\n";

($drstr, $dr) = &find_type2("D", "R", $conf);
print "<tr> <td>",&hlink("<b>$text{'opts_dr'}</b>",
			 "opt_DR"),"</td>\n";
print "<td colspan=3>\n";
printf "<input type=radio name=DR_def value=1 %s> $text{'opts_local'}\n",
	$dr ? "" : "checked";
printf "<input type=radio name=DR_def value=0 %s>\n",
	$dr ? "checked" : "";
print "<input name=DR size=25 value=\"$dr\"></td> </tr>\n";

($dhstr, $dh) = &find_type2("D", "H", $conf);
print "<tr> <td>",&hlink("<b>$text{'opts_dh'}</b>",
			 "opt_DH"),"</td>\n";
print "<td colspan=3>\n";
printf "<input type=radio name=DH_def value=1 %s> $text{'opts_local'}\n",
	$dh ? "" : "checked";
printf "<input type=radio name=DH_def value=0 %s>\n",
	$dh ? "checked" : "";
print "<input name=DH size=25 value=\"$dh\"></td> </tr>\n";

($dmstr, $dm) = &find_option("DeliveryMode", $conf);
print "<tr> <td>",&hlink("<b>$text{'opts_dmode'}</b>","opt_dmode"),
      "</td> <td colspan=3>\n";
printf "<input type=radio name=DeliveryMode value='' %s> $text{'default'}\n",
	$dm ? '' : 'checked';
foreach $dmo ('background', 'queue-only', 'interactive', 'deferred') {
	local $dmoc = substr($dmo, 0, 1);
	printf "<input type=radio name=DeliveryMode value=%s %s> %s\n",
		$dmo, $dm =~ /^$dmoc/ ? 'checked' : '', $text{"opts_$dmo"};
	}
print "</td> </tr>\n";

$ver = &check_sendmail_version($conf);
if ($ver >= 9) {
	print "<tr>\n";
	&option_input($text{'opts_daemon'}, "DaemonPortOptions", $conf,
		      $default, 50);
	print "</tr>\n";
	}

print "<tr>\n";
&option_input($text{'opts_queuela'}, "QueueLA", $conf, $default, 6);
&option_input($text{'opts_refusela'}, "RefuseLA", $conf, $default,6);
print "</tr>\n";

print "<tr>\n";
&option_input($text{'opts_maxch'}, "MaxDaemonChildren",
	      $conf, $default, 6);
&option_input($text{'opts_throttle'}, "ConnectionRateThrottle",
	      $conf, $default, 6);
print "</tr>\n";

print "<tr>\n";
&option_input($text{'opts_minqueueage'}, "MinQueueAge",
	      $conf, $default, 6);
&option_input($text{'opts_runsize'}, "MaxQueueRunSize", $conf, $default, 8);
print "</tr>\n";

print "<tr>\n";
&option_input($text{'opts_queuereturn'}, "Timeout.queuereturn",
	      $conf, $default, 6);
&option_input($text{'opts_queuewarn'}, "Timeout.queuewarn",
	      $conf, $default, 6);
print "</tr>\n";

print "<tr>\n";
&option_input($text{'opts_queue'}, "QueueDirectory", $conf, $default, 35);
print "</tr>\n";

print "<tr>\n";
&option_input($text{'opts_postmaster'}, "PostMasterCopy",
	      $conf, "Postmaster", 35);
print "</tr>\n";

print "<tr>\n";
&option_input($text{'opts_forward'}, "ForwardPath", $conf, $default, 35);
print "</tr>\n";

print "<tr>\n";
&option_input($text{'opts_minfree'}, "MinFreeBlocks",
	      $conf, $default, 8, $text{'opts_blocks'});
&option_input($text{'opts_maxmessage'}, "MaxMessageSize",
	      $conf, $default, 10, $text{'opts_bytes'});
print "</tr>\n";

print "<tr>\n";
&option_input($text{'opts_loglevel'}, "LogLevel", $conf, $default, 4);
($vstr, $v) = &find_option("SendMimeErrors", $conf);
print "<td>",&hlink("<b>$text{'opts_mimebounce'}</b>","opt_SendMimeErrors"),
      "</td> <td>\n";
printf "<input type=radio name=SendMimeErrors value=True %s> $text{'yes'}\n",
	$v eq "True" ? "checked" : "";
printf "<input type=radio name=SendMimeErrors value=False %s> $text{'no'}\n",
	$v eq "True" ? "" : "checked";
print "</td> </tr>\n";

print "<tr>\n";
($gstr, $g) = &find_option("MatchGECOS", $conf);
print "<td>",&hlink("<b>$text{'opts_gecos'}</b>","opt_MatchGECOS"),
      "</td> <td>\n";
printf "<input type=radio name=MatchGECOS value=True %s> $text{'yes'}\n",
	$g eq "True" ? "checked" : "";
printf "<input type=radio name=MatchGECOS value=False %s> $text{'no'}</td>\n",
	$g eq "True" ? "" : "checked";
&option_input($text{'opts_hops'}, "MaxHopCount", $conf, $default, 4);
print "</tr>\n";

print "<tr>\n";
($bstr, $b) = &find_option("DontBlameSendmail", $conf);
print "<td valign=top>",&hlink("<b>$text{'opts_blame'}</b>",
      "opt_DontBlameSendmail"),"</td> <td colspan=3>\n";
printf "<input type=radio name=DontBlameSendmail_def value=1 %s> %s\n",
	$b ? '' : 'checked', $text{'default'};
printf "<input type=radio name=DontBlameSendmail_def value=0 %s> %s<br>\n",
	$b ? 'checked' : '', $text{'opts_selected'};
map { $b{lc($_)} = 1 } split(/[\s,]+/, $b);
printf "<select name=DontBlameSendmail size=5 multiple>\n";
foreach $bo ('Safe', 'AssumeSafeChown', 'ClassFileInUnsafeDirPath',
	     'DontWarnForwardFileInUnsafeDirPath', 'ErrorHeaderInUnsafeDirPath',
	     'GroupWritableDirPathSafe', 'GroupWritableForwardFileSafe',
	     'GroupWritableIncludeFileSafe', 'GroupWritableAliasFile',
	     'HelpFileInUnsafeDirPath', 'WorldWritableAliasFile',
	     'ForwardFileInGroupWritableDirPath',
	     'IncludeFileInGroupWritableDirPath', 'ForwardFileInUnsafeDirPath',
	     'IncludeFileInUnsafeDirPath', 'ForwardFileInUnsafeDirPathSafe',
	     'IncludeFileInUnsafeDirPathSafe', 'MapInUnsafeDirPath',
	     'LinkedAliasFileInWritableDir', 'LinkedClassFileInWritableDir',
	     'LinkedForwardFileInWritableDir', 'LinkedIncludeFileInWritableDir',
	     'LinkedMapInWritableDir', 'LinkedServiceSwitchFileInWritableDir',
	     'FileDeliveryToHardLink', 'FileDeliveryToSymLink',
	     'RunProgramInUnsafeDirPath', 'RunWritableProgram',
	     'WriteMapToHardLink', 'WriteMapToSymLink', 'WriteStatsToHardLink',
	     'WriteStatsToSymLink', 'TrustStickyBit', 'NonRootSafeAddr') {
	printf "<option %s>%s\n", $b{lc($bo)} ? 'selected' : '', $bo;
	delete($b{lc($bo)});
	}
foreach $bo (keys %b) {
	print "<option selected>$bo\n";
	}
print "</select></td> </tr>\n";

print "</table></td></tr></table><p>\n";
print "<input type=submit value=\"$text{'opts_save'}\"></form>\n";

&ui_print_footer("", $text{'index_return'});

# option_input(desc, name, &config, default, size, units)
sub option_input
{
local ($vstr, $v) = &find_option($_[1], $_[2]);
printf "<td>".&hlink("<b>$_[0]</b>","opt_".$_[1])."</td> <td %s nowrap>\n",
	$_[4] > 20 ? "colspan=3" : "";
printf "<input type=radio name=$_[1]_def value=1 %s> $_[3]\n",
	defined($v) ? "" : "checked";
printf "<input type=radio name=$_[1]_def value=0 %s>\n",
	defined($v) ? "checked" : "";
print "<input name=$_[1] size=$_[4] value=\"$v\"> $_[5]</td>\n";
}