require 'sendmail-lib.pl';
# acl_security_form(&options)
# Output HTML for editing security options for the sendmail module
sub acl_security_form
{
print "
$text{'acl_opts'} \n";
printf " $text{'yes'}\n",
$_[0]->{'opts'} ? "checked" : "";
printf " $text{'no'} \n",
$_[0]->{'opts'} ? "" : "checked";
print "$text{'acl_cws'} \n";
printf " $text{'yes'}\n",
$_[0]->{'cws'} ? "checked" : "";
printf " $text{'no'} \n",
$_[0]->{'cws'} ? "" : "checked";
print " $text{'acl_masq'} \n";
printf " $text{'yes'}\n",
$_[0]->{'masq'} ? "checked" : "";
printf " $text{'no'} \n",
$_[0]->{'masq'} ? "" : "checked";
print "$text{'acl_trusts'} \n";
printf " $text{'yes'}\n",
$_[0]->{'trusts'} ? "checked" : "";
printf " $text{'no'} \n",
$_[0]->{'trusts'} ? "" : "checked";
print " $text{'acl_cgs'} \n";
printf " $text{'yes'}\n",
$_[0]->{'cgs'} ? "checked" : "";
printf " $text{'no'} \n",
$_[0]->{'cgs'} ? "" : "checked";
print "$text{'acl_relay'} \n";
printf " $text{'yes'}\n",
$_[0]->{'relay'} ? "checked" : "";
printf " $text{'no'} \n",
$_[0]->{'relay'} ? "" : "checked";
print " $text{'acl_mailers'} \n";
printf " $text{'yes'}\n",
$_[0]->{'mailers'} ? "checked" : "";
printf " $text{'no'} \n",
$_[0]->{'mailers'} ? "" : "checked";
print "$text{'acl_access'} \n";
printf " $text{'yes'}\n",
$_[0]->{'access'} ? "checked" : "";
printf " $text{'no'} \n",
$_[0]->{'access'} ? "" : "checked";
print " $text{'acl_domains'} \n";
printf " $text{'yes'}\n",
$_[0]->{'domains'} ? "checked" : "";
printf " $text{'no'} \n",
$_[0]->{'domains'} ? "" : "checked";
print "$text{'acl_stop'} \n";
printf " $text{'yes'}\n",
$_[0]->{'stop'} ? "checked" : "";
printf " $text{'no'} \n",
$_[0]->{'stop'} ? "" : "checked";
print " $text{'acl_manual'} \n";
printf " $text{'yes'}\n",
$_[0]->{'manual'} ? "checked" : "";
printf " $text{'no'} \n",
$_[0]->{'manual'} ? "" : "checked";
print "$text{'acl_mailq'} \n";
printf "$text{'acl_viewdel'} \n",
$_[0]->{'mailq'} == 2 ? "selected" : "";
printf "$text{'acl_view'} \n",
$_[0]->{'mailq'} == 1 ? "selected" : "";
printf "$text{'no'} \n",
$_[0]->{'mailq'} == 0 ? "selected" : "";
print " \n";
print " $text{'acl_qdoms'} \n";
printf " %s\n",
$_[0]->{'qdoms'} ? "" : "checked", $text{'acl_all'};
printf " %s\n",
$_[0]->{'qdoms'} ? "checked" : "", $text{'acl_matching'};
printf " \n",
$_[0]->{'qdoms'};
print " $text{'acl_qdomsmode'} \n";
foreach $m (0 .. 2) {
printf " %s\n",
$m, $_[0]->{'qdomsmode'} == $m ? "checked" : "",
$text{'acl_qdomsmode'.$m};
}
print " \n";
print " $text{'acl_flushq'} \n";
printf " $text{'yes'}\n",
$_[0]->{'flushq'} ? "checked" : "";
printf " $text{'no'} \n",
$_[0]->{'flushq'} ? "" : "checked";
print "$text{'acl_ports'} \n";
printf " $text{'yes'}\n",
$_[0]->{'ports'} ? "checked" : "";
printf " $text{'no'} \n",
$_[0]->{'ports'} ? "" : "checked";
# Virtusers
print " \n";
print " $text{'acl_virtusers'} \n";
printf " $text{'acl_none'}\n",
$_[0]->{'vmode'} == 0 ? "checked" : "";
printf " $text{'acl_all'}\n",
$_[0]->{'vmode'} == 1 ? "checked" : "";
printf " $text{'acl_vsame'} \n",
$_[0]->{'vmode'} == 3 ? "checked" : "";
printf " $text{'acl_matching'}\n",
$_[0]->{'vmode'} == 2 ? "checked" : "";
printf " \n",
$_[0]->{'vaddrs'};
print " $text{'acl_vtypes'} \n";
print "\n";
for($n=0; $n<3; $n++) {
printf " %s\n",
$n, $_[0]->{"vedit_$n"} ? "checked" : "", $text{"acl_vtype$n"};
}
print " \n";
print " $text{'acl_vmax'} \n";
printf " %s\n",
$_[0]->{'vmax'} ? "" : "checked", $text{'acl_unlimited'};
printf " \n",
$_[0]->{'vmax'} ? "checked" : "";
printf " \n",
$_[0]->{'vmax'};
print "$text{'acl_vcatchall'} \n";
print "",&ui_yesno_radio("vcatchall",
int($_[0]->{'vcatchall'}))," \n";
# Aliases
print " \n";
print " $text{'acl_aliases'} \n";
printf " $text{'acl_none'}\n",
$_[0]->{'amode'} == 0 ? "checked" : "";
printf " $text{'acl_all'}\n",
$_[0]->{'amode'} == 1 ? "checked" : "";
printf " $text{'acl_asame'} \n",
$_[0]->{'amode'} == 3 ? "checked" : "";
printf " $text{'acl_matching'}\n",
$_[0]->{'amode'} == 2 ? "checked" : "";
printf " \n",
$_[0]->{'aliases'};
print " $text{'acl_atypes'} \n";
for($n=1; $n<=6; $n++) {
printf " %s\n",
$n, $_[0]->{"aedit_$n"} ? "checked" : "",
$text{"acl_atype$n"};
}
print " \n";
print " $text{'acl_amax'} \n";
printf " %s\n",
$_[0]->{'amax'} ? "" : "checked", $text{'acl_unlimited'};
printf " \n",
$_[0]->{'amax'} ? "checked" : "";
printf " \n",
$_[0]->{'amax'};
print " $text{'acl_apath'} \n";
printf " %s \n",
$_[0]->{'apath'}, &file_chooser_button("apath", 1);
# Outgoing address mappings
print " \n";
print " $text{'acl_outgoing'} \n";
printf " $text{'acl_none'}\n",
$_[0]->{'omode'} == 0 ? "checked" : "";
printf " $text{'acl_all'} \n",
$_[0]->{'omode'} == 1 ? "checked" : "";
printf " $text{'acl_matching'}\n",
$_[0]->{'omode'} == 2 ? "checked" : "";
printf " \n",
$_[0]->{'oaddrs'};
# Spam control rules
print " \n";
print " $text{'acl_spam'} \n";
printf " $text{'acl_all'}\n",
$_[0]->{'smode'} == 1 ? "checked" : "";
printf " $text{'acl_matching'}\n",
$_[0]->{'smode'} == 2 ? "checked" : "";
printf " \n",
$_[0]->{'saddrs'};
}
# acl_security_save(&options)
# Parse the form for security options for the sendmail module
sub acl_security_save
{
$_[0]->{'opts'} = $in{'opts'};
$_[0]->{'ports'} = $in{'ports'};
$_[0]->{'cws'} = $in{'cws'};
$_[0]->{'masq'} = $in{'masq'};
$_[0]->{'trusts'} = $in{'trusts'};
$_[0]->{'cgs'} = $in{'cgs'};
$_[0]->{'relay'} = $in{'relay'};
$_[0]->{'manual'} = $in{'manual'};
$_[0]->{'mailq'} = $in{'mailq'};
$_[0]->{'qdoms'} = $in{'qdoms_def'} ? undef : $in{'qdoms'};
$_[0]->{'qdomsmode'} = $in{'qdomsmode'};
$_[0]->{'mailers'} = $in{'mailers'};
$_[0]->{'access'} = $in{'access'};
$_[0]->{'domains'} = $in{'domains'};
$_[0]->{'stop'} = $in{'stop'};
$_[0]->{'vmode'} = $in{'vmode'};
$_[0]->{'vaddrs'} = $in{'vmode'} == 2 ? $in{'vaddrs'} : "";
$_[0]->{'vmax'} = $in{'vmax_def'} ? undef : $in{'vmax'};
foreach $i (0..2) {
$_[0]->{"vedit_$i"} = $in{"vedit_$i"};
}
$_[0]->{'vcatchall'} = $in{'vcatchall'};
$_[0]->{'amode'} = $in{'amode'};
$_[0]->{'aliases'} = $in{'amode'} == 2 ? $in{'aliases'} : "";
$_[0]->{'amax'} = $in{'amax_def'} ? undef : $in{'amax'};
$_[0]->{'apath'} = $in{'apath'};
foreach $i (1..6) {
$_[0]->{"aedit_$i"} = $in{"aedit_$i"};
}
$_[0]->{'omode'} = $in{'omode'};
$_[0]->{'oaddrs'} = $in{'omode'} == 2 ? $in{'oaddrs'} : "";
$_[0]->{'flushq'} = $in{'flushq'};
$_[0]->{'smode'} = $in{'smode'};
$_[0]->{'saddrs'} = $in{'smode'} == 2 ? $in{'saddrs'} : "";
}