From 39e07b5d647db910be0dc5dae72a9c3c075fbb61 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sat, 22 Oct 2011 10:25:12 -0700 Subject: [PATCH] Prevent use of notify_classes that are invalid https://www.virtualmin.com/node/19820 --- postfix/general.cgi | 23 ++++++++++++++++++++++- postfix/lang/en | 1 + postfix/postfix-lib.pl | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/postfix/general.cgi b/postfix/general.cgi index 43ccb97e9..015f170df 100755 --- a/postfix/general.cgi +++ b/postfix/general.cgi @@ -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'} ] ]). + "
\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); diff --git a/postfix/lang/en b/postfix/lang/en index 1a7e20abd..543370868 100644 --- a/postfix/lang/en +++ b/postfix/lang/en @@ -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 diff --git a/postfix/postfix-lib.pl b/postfix/postfix-lib.pl index 5b9766146..40b944c2f 100755 --- a/postfix/postfix-lib.pl +++ b/postfix/postfix-lib.pl @@ -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)) {