From db57c2dbeaece7bca22ceda6a5df55769bbe0a02 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Mon, 29 Mar 2010 13:55:22 -0700 Subject: [PATCH] Allow cidr maps and multiple SMTP client maps --- postfix/CHANGELOG | 2 ++ postfix/client.cgi | 2 +- postfix/postfix-lib.pl | 17 +++++++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/postfix/CHANGELOG b/postfix/CHANGELOG index 52245dc80..7a22c027c 100644 --- a/postfix/CHANGELOG +++ b/postfix/CHANGELOG @@ -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. diff --git a/postfix/client.cgi b/postfix/client.cgi index 53fb9d157..a892f6815 100755 --- a/postfix/client.cgi +++ b/postfix/client.cgi @@ -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; diff --git a/postfix/postfix-lib.pl b/postfix/postfix-lib.pl index 97d084c6b..92afbadf7 100755 --- a/postfix/postfix-lib.pl +++ b/postfix/postfix-lib.pl @@ -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)