Allow cidr maps and multiple SMTP client maps
authorJamie Cameron <jcameron@webmin.com>
Mon, 29 Mar 2010 20:55:22 +0000 (13:55 -0700)
committerJamie Cameron <jcameron@webmin.com>
Mon, 29 Mar 2010 20:55:22 +0000 (13:55 -0700)
postfix/CHANGELOG
postfix/client.cgi
postfix/postfix-lib.pl

index 52245dc..7a22c02 100644 (file)
@@ -73,3 +73,5 @@ t/html MIME type.
 ---- Changes since 1.500 ----
 If a map is made up of files in multiple directories and a Webmin user has a directory restriction defined, he will be able to edit map entries in files under that directory.
 Fixed the descriptions of logged events as shown in the Webmin Actions Log module.
+---- Changes since 1.510 ----
+Added support for CIDR maps and multiple SMTP client restriction maps.
index 53fb9d1..a892f68 100755 (executable)
@@ -39,7 +39,7 @@ foreach $r (&list_multi_client_restrictions()) {
                }
        push(@grid, &ui_checkbox("client", $r, $text{'sasl_'.$r},
                                 scalar(@v)),
-                   &ui_textbox("value_$r", $vals, 40).
+                   &ui_textbox("value_$r", $vals, 60).
                    ($r eq "check_client_access" ?
                        " ".&map_chooser_button("value_$r", $r) : ""));
        $done{$r} = 1;
index 97d084c..92afbad 100755 (executable)
@@ -152,11 +152,16 @@ if (!defined($out)) {
        chop($out);
        }
 if ($key) {
-       my @res=();
-       foreach (split /,/,$out)
-           { push @res, $1 if /$key\s+(.+)/; }
-       if ($#res>0) {$out=join ", ",@res}
-       else {$out=$res[0]}
+       # If the value asked for was like foo:bar, extract from the value
+       # the parts after bar
+       my @res = ( );
+        while($out =~ /^(.*?)\Q$key\E\s+(\S+)(.*)$/) {
+               my $v = $2;
+               $out = $3;
+               $v =~ s/,$//;
+               push(@res, $v);
+               }
+       return join(" ", @res);
        }
 return $out;
 }
@@ -2172,7 +2177,7 @@ sub file_map_type
 {
 local ($type) = @_;
 return 1 if ($type eq 'hash' || $type eq 'regexp' || $type eq 'pcre' ||
-            $type eq 'btree' || $type eq 'dbm');
+            $type eq 'btree' || $type eq 'dbm' || $type eq 'cidr');
 }
 
 # in_props(&props, name)