Prevent use of notify_classes that are invalid
authorJamie Cameron <jcameron@webmin.com>
Sat, 22 Oct 2011 17:25:12 +0000 (10:25 -0700)
committerJamie Cameron <jcameron@webmin.com>
Sat, 22 Oct 2011 17:25:12 +0000 (10:25 -0700)
https://www.virtualmin.com/node/19820

postfix/general.cgi
postfix/lang/en
postfix/postfix-lib.pl

index 43ccb97..015f170 100755 (executable)
@@ -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);
index 1a7e20a..5433708 100644 (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
index 5b97661..40b944c 100755 (executable)
@@ -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)) {