
require 'postfix-lib.pl';

# Print the form for security options of postfix module
sub acl_security_form
{
print "<tr>\n<td><b>$text{'acl_resource'}</b></td> <td>\n";
printf "<input type=radio name=resource value=1 %s> $text{'yes'}\n",
		$_[0]->{'resource'} ? "checked" : "";
printf "<input type=radio name=resource value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'resource'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_address_rewriting'}</b></td> <td>\n";
printf "<input type=radio name=address_rewriting value=1 %s> $text{'yes'}\n",
		$_[0]->{'address_rewriting'} ? "checked" : "";
printf "<input type=radio name=address_rewriting value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'address_rewriting'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_aliases'}</b></td> <td>\n";
printf "<input type=radio name=aliases value=1 %s> $text{'yes'}\n",
		$_[0]->{'aliases'} ? "checked" : "";
printf "<input type=radio name=aliases value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'aliases'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_general'}</b></td> <td>\n";
printf "<input type=radio name=general value=1 %s> $text{'yes'}\n",
		$_[0]->{'general'} ? "checked" : "";
printf "<input type=radio name=general value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'general'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_canonical'}</b></td> <td>\n";
printf "<input type=radio name=canonical value=1 %s> $text{'yes'}\n",
		$_[0]->{'canonical'} ? "checked" : "";
printf "<input type=radio name=canonical value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'canonical'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_virtual'}</b></td> <td>\n";
printf "<input type=radio name=virtual value=1 %s> $text{'yes'}\n",
		$_[0]->{'virtual'} ? "checked" : "";
printf "<input type=radio name=virtual value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'virtual'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_transport'}</b></td> <td>\n";
printf "<input type=radio name=transport value=1 %s> $text{'yes'}\n",
		$_[0]->{'transport'} ? "checked" : "";
printf "<input type=radio name=transport value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'transport'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_relocated'}</b></td> <td>\n";
printf "<input type=radio name=relocated value=1 %s> $text{'yes'}\n",
		$_[0]->{'relocated'} ? "checked" : "";
printf "<input type=radio name=relocated value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'relocated'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_local_delivery'}</b></td> <td>\n";
printf "<input type=radio name=local_delivery value=1 %s> $text{'yes'}\n",
		$_[0]->{'local_delivery'} ? "checked" : "";
printf "<input type=radio name=local_delivery value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'local_delivery'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_smtpd'}</b></td> <td>\n";
printf "<input type=radio name=smtpd value=1 %s> $text{'yes'}\n",
		$_[0]->{'smtpd'} ? "checked" : "";
printf "<input type=radio name=smtpd value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'smtpd'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_smtp'}</b></td> <td>\n";
printf "<input type=radio name=smtp value=1 %s> $text{'yes'}\n",
		$_[0]->{'smtp'} ? "checked" : "";
printf "<input type=radio name=smtp value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'smtp'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_rate'}</b></td> <td>\n";
printf "<input type=radio name=rate value=1 %s> $text{'yes'}\n",
		$_[0]->{'rate'} ? "checked" : "";
printf "<input type=radio name=rate value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'rate'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_debug'}</b></td> <td>\n";
printf "<input type=radio name=debug value=1 %s> $text{'yes'}\n",
		$_[0]->{'debug'} ? "checked" : "";
printf "<input type=radio name=debug value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'debug'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_ldap'}</b></td> <td>\n";
printf "<input type=radio name=ldap value=1 %s> $text{'yes'}\n",
		$_[0]->{'ldap'} ? "checked" : "";
printf "<input type=radio name=ldap value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'ldap'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_startstop'}</b></td> <td>\n";
printf "<input type=radio name=startstop value=1 %s> $text{'yes'}\n",
		$_[0]->{'startstop'} ? "checked" : "";
printf "<input type=radio name=startstop value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'startstop'} ? "" : "checked";
print "</tr>\n";

print "<tr>\n<td><b>$text{'acl_mailq'}</b></td> <td>\n";
printf "<input type=radio name=mailq value=1 %s> $text{'yes'}\n",
		$_[0]->{'mailq'} ? "checked" : "";
printf "<input type=radio name=mailq value=0 %s> $text{'no'}</td>\n",
		$_[0]->{'mailq'} ? "" : "checked";
print "</tr>\n";

}


# acl_security_save(&options)
# Parse the form for security options for the postfix module
sub acl_security_save
{
$_[0]->{'aliases'} = $in{'aliases'};
$_[0]->{'general'} = $in{'general'};
$_[0]->{'address_rewriting'} = $in{'address_rewriting'};
$_[0]->{'canonical'} = $in{'canonical'};
$_[0]->{'virtual'} = $in{'virtual'};
$_[0]->{'transport'} = $in{'transport'};
$_[0]->{'relocated'} = $in{'relocated'};
$_[0]->{'local_delivery'} = $in{'local_delivery'};
$_[0]->{'resource'} = $in{'resource'};
$_[0]->{'smtpd'} = $in{'smtpd'};
$_[0]->{'smtp'} = $in{'smtp'};
$_[0]->{'rate'} = $in{'rate'};
$_[0]->{'debug'} = $in{'debug'};
$_[0]->{'ldap'} = $in{'ldap'};
$_[0]->{'startstop'} = $in{'startstop'};
$_[0]->{'mailq'} = $in{'mailq'};
}


