Prevent use of notify_classes that are invalid

https://www.virtualmin.com/node/19820
This commit is contained in:
Jamie Cameron
2011-10-22 10:25:12 -07:00
parent ca93c866ed
commit 39e07b5d64
3 changed files with 24 additions and 1 deletions

View File

@@ -27,7 +27,28 @@ print &ui_table_start($text{'general_title_sensible'}, "width=100%", 4);
&option_radios_freefield("mydestination", 60, $text{'opts_mydestination_default'},
'$myhostname, localhost.$mydomain, $mydomain', $text{'opts_mydestination_domainwide'});
&option_radios_freefield("notify_classes", 40, $default);
$v = &if_default_value("notify_classes") ? "" :
&get_current_value("notify_classes");
@v = split(/[, ]+/, $v);
print &ui_table_row(&hlink($text{'opts_notify_classes'},
'opts_notify_classes'),
&ui_radio("notify_classes_def",
$v ? "__USE_FREE_FIELD__"
: "__DEFAULT_VALUE_IE_NOT_IN_CONFIG_FILE__",
[ [ "__DEFAULT_VALUE_IE_NOT_IN_CONFIG_FILE__",
$text{'default'} ],
[ "__USE_FREE_FIELD__",
$text{'opts_notify_classes_sel'} ] ]).
"<br>\n".
&ui_select("notify_classes", \@v,
[ [ "bounce", "bounce - Bounced mail" ],
[ "2bounce", "2bounce - Double-bounced mail" ],
[ "delay", "delay - Delayed mail" ],
[ "policy", "policy - Policy rejected clients" ],
[ "protocol", "protocol - Client protocol errors" ],
[ "resource", "resource - Resource problems" ],
[ "software", "software - Software problems" ] ],
7, 1, 1));
print &ui_table_end();
print &ui_table_start($text{'general_title_others'}, "width=100%", 4);

View File

@@ -144,6 +144,7 @@ opts_mydestination=What domains to receive mail for
opts_mydestination_default=Local machine
opts_mydestination_domainwide=Whole domain
opts_notify_classes=What trouble to report to the postmaster
opts_notify_classes_sel=Selected below
opts_queue_directory=Mail queue directory
opts_mail_owner=Mail owner
opts_default_privs=Default rights of the delivery agent

View File

@@ -556,6 +556,7 @@ sub save_options
(my $param = $key) =~ s/_def//;
my $value = $options{$key} eq "__USE_FREE_FIELD__" ?
$options{$param} : $options{$key};
$value =~ s/\0/, /g;
if ($value =~ /(\S+):(\/\S+)/ && $access{'dir'} ne '/') {
foreach my $f (&get_maps_files("$1:$2")) {
if (!&is_under_directory($access{'dir'}, $f)) {