require 'mailboxes-lib.pl';
# acl_security_form(&options)
# Output HTML for editing security options for the sendmail module
sub acl_security_form
{
# Users whose mail can be read
print "
$text{'acl_read'} \n";
printf " $text{'acl_none'}\n",
$_[0]->{'mmode'} == 0 ? "checked" : "";
printf " $text{'acl_same'}\n",
$_[0]->{'mmode'} == 4 ? "checked" : "";
printf " $text{'acl_all'} \n",
$_[0]->{'mmode'} == 1 ? "checked" : "";
printf " $text{'acl_users'}\n",
$_[0]->{'mmode'} == 2 ? "checked" : "";
printf " %s \n",
$_[0]->{'mmode'} == 2 ? $_[0]->{'musers'} : "",
&user_chooser_button("musers", 1);
printf " $text{'acl_userse'}\n",
$_[0]->{'mmode'} == 3 ? "checked" : "";
printf " %s \n",
$_[0]->{'mmode'} == 3 ? $_[0]->{'musers'} : "",
&user_chooser_button("muserse", 1);
printf " $text{'acl_usersg'}\n",
$_[0]->{'mmode'} == 5 ? "checked" : "";
printf " %s\n",
$_[0]->{'mmode'} == 5 ? join(" ", map { scalar(getgrgid($_)) }
split(/\s+/, $_[0]->{'musers'})) : "",
&group_chooser_button("musersg", 1);
printf " %s \n",
$_[0]->{'msec'} ? "checked" : "", $text{'acl_sec'};
printf " $text{'acl_usersu'}\n",
$_[0]->{'mmode'} == 7 ? "checked" : "";
printf " -\n",
$_[0]->{'mmode'} == 7 ? $_[0]->{'musers'} : "";
printf " \n",
$_[0]->{'mmode'} == 7 ? $_[0]->{'musers2'} : "";
printf " $text{'acl_usersm'}\n",
$_[0]->{'mmode'} == 6 ? "checked" : "";
printf " \n",
$_[0]->{'mmode'} == 6 ? $_[0]->{'musers'} : "";
# Directory for arbitrary files
print " $text{'acl_dir'} \n";
print &ui_opt_textbox("dir", $_[0]->{'dir'}, 40, $text{'acl_dirauto'}." ");
print " \n";
# Allowed From: addresses
print " $text{'acl_from'} \n";
printf " $text{'acl_any'} \n",
$_[0]->{'fmode'} == 0 ? "checked" : "";
printf " $text{'acl_fdoms'}\n",
$_[0]->{'fmode'} == 1 ? "checked" : "";
printf " \n",
$_[0]->{'fmode'} == 1 ? $_[0]->{'from'} : '';
printf " $text{'acl_faddrs'}\n",
$_[0]->{'fmode'} == 2 ? "checked" : "";
printf " \n",
$_[0]->{'fmode'} == 2 ? $_[0]->{'from'} : '';
printf " $text{'acl_fdom'}\n",
$_[0]->{'fmode'} == 3 ? "checked" : "";
printf " \n",
$_[0]->{'fmode'} == 3 ? $_[0]->{'from'} : '';
print " \n";
print " $text{'acl_fromname'} \n";
print " {'fromname'}'> \n";
print " $text{'acl_attach'} \n";
printf " %s\n",
$_[0]->{'attach'}<0 ? 'checked' : '', $text{'acl_unlimited'};
printf " \n",
$_[0]->{'attach'}<0 ? '' : 'checked';
printf " kB\n",
$_[0]->{'attach'}<0 ? '' : $_[0]->{'attach'};
print " \n";
print " $text{'acl_canattach'} \n";
printf " %s\n",
$_[0]->{'canattach'} ? 'checked' : '', $text{'yes'};
printf " %s \n",
$_[0]->{'canattach'} ? '' : 'checked', $text{'no'};
print " $text{'acl_candetach'} \n";
printf " %s\n",
$_[0]->{'candetach'} ? 'checked' : '', $text{'yes'};
printf " %s \n",
$_[0]->{'candetach'} ? '' : 'checked', $text{'no'};
}
# acl_security_save(&options)
# Parse the form for security options for the sendmail module
sub acl_security_save
{
$_[0]->{'mmode'} = $in{'mmode'};
$_[0]->{'musers'} = $in{'mmode'} == 2 ? $in{'musers'} :
$in{'mmode'} == 3 ? $in{'muserse'} :
$in{'mmode'} == 5 ? join(" ", map { scalar(getgrnam($_)) }
split(/\s+/, $in{'musersg'})) :
$in{'mmode'} == 6 ? $in{'musersm'} :
$in{'mmode'} == 7 ? $in{'musersu1'} : "";
$_[0]->{'musers2'} = $in{'mmode'} == 7 ? $in{'musersu2'} : "";
$_[0]->{'msec'} = $in{'msec'};
$_[0]->{'fmode'} = $in{'fmode'};
$_[0]->{'from'} = $in{'fmode'} == 0 ? undef :
$in{'fmode'} == 1 ? $in{'fdoms'} :
$in{'fmode'} == 2 ? $in{'faddrs'} : $in{'fdom'};
$_[0]->{'fromname'} = $in{'fromname'};
$_[0]->{'attach'} = $in{'attach_def'} ? -1 : $in{'attach'};
$_[0]->{'canattach'} = $in{'canattach'};
$_[0]->{'candetach'} = $in{'candetach'};
$_[0]->{'dir'} = $in{'dir_def'} ? undef : $in{'dir'};
}