List Info

Thread: read_array & CIDR




read_array & CIDR
user name
2006-05-04 19:15:32
Hi,

there is probably bug in reading "mynetworks"
configuration file in 
amavis-new release 2.4.0. I want to specify local networks
in CIDR format 
and I read the file with read_array function. In
amavisd.conf I have 
following line:

mynetworks_maps =
(read_array('/etc/amavisd-mynetworks'), \mynetworks);

and in /etc/amavisd-mynetworks I have something like
123.123.1.0/24
123.123.2.0/24
...

The function read_array add '' at the end of each line
and that's why 
calling ip_to_vec fail with "Invalid IPv4 network mask
or CIDR prefix 
length: [123.123.1.0/24]".

I fix it with following patch, but I don't thing it is the
best place to 
fix this problem...


--- amavisd     2006-04-25 14:15:38.000000000 +0200
+++ amavisd     2006-04-25 14:15:26.000000000 +0200
 -3055,7
+3055,7 
my($ip,$allow_mask) = _;
my($ip_len); my(ip_fields);
local($1,$2,$3,$4,$5,$6);
-  $ip =~ s/^[ \t]+//; $ip =~ s/[ \t\n]+\z//s;  # trim
+  $ip =~ s/^[ \t]+//; $ip =~ s/[ \t\n]+\z//s;  # trim
my($ipa) = $ip;
($ipa,$ip_len) = ($1,$2)  if $allow_mask && $ip =~
m{^([^/]*)/(.*)\z}s;
$ipa = $1  if $ipa =~ m{^ \[ (.*) \] \z}xs;      #
discard optional 
brackets




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
AMaViS-user mailing list
AMaViS-userlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user

AMaViS-FAQ:http://www.amav
is.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/ho
wto/
read_array & CIDR
user name
2006-05-04 19:37:03
Petr,

> there is probably bug in reading
"mynetworks" configuration file in
> amavis-new release 2.4.0. I want to specify local
networks in CIDR format
> and I read the file with read_array function. In
amavisd.conf I have
> following line:
>
> mynetworks_maps =
(read_array('/etc/amavisd-mynetworks'), \mynetworks);
>
> and in /etc/amavisd-mynetworks I have something like
> 123.123.1.0/24
> 123.123.2.0/24
> ...
>
> The function read_array add '' at the end of each line
and that's why
> calling ip_to_vec fail with "Invalid IPv4 network
mask or CIDR prefix
> length: [123.123.1.0/24]".

Thanks, it will be fixed in 2.4.1  (a 2.4.1-rc1 probably
later today).

- modify unquote_rfc2821_local so that it appends an '' as a
domain name
  only if localpart contains '', so that read_array()
can still be
  used to read a list of networks in CIDR notation; a change
in 2.4.0
  to properly handle addresses like "aaabbb" made read_array unsuitable
  for reading list of networks; pointed out by Petr Vokac;


Mark


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
AMaViS-user mailing list
AMaViS-userlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user

AMaViS-FAQ:http://www.amav
is.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/ho
wto/
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )