On 10/04/18 09:38, Daniele Duca wrote: > Hi, > > I'm experimenting an odd behaviour while using TxRep. I have set in my > local.cf "txrep_ipv4_mask_len 24" , but the database is populated by /16 > instead of the expected /24. > > Digging in TxRep.pm I started using dbg() to see if it would at least read > the correct value "24" from the .cf , and confirmed that, around line 528, > the code > Completely untested patch attached, will double check it later. Cheers Giovanni
> $self->{txrep_ipv4_mask_len} = $value; > > is correctly working, meaning that $value has the value of "24" > > The problem arise around line 1727, in the following snippet: > > my $mask_len = $self->{txrep_ipv4_mask_len}; > $mask_len = 16 if !defined $mask_len; > > In this case "$self->{txrep_ipv4_mask_len}" is empty, and the value is set to > the default of "16". > > This behaviour is consistent in nine different installations with the > following specs: > > Ubuntu 16.04.4 - SA 3.4.1 - Perl v5.22.1 > Ubuntu 18.04.1 - SA 3.4.2 (CPAN) - Perl v5.26.1 > > Any thoughts? My perl-fu is not good enough to debug this :/ > > Thanks > Daniele Duca
Index: lib/Mail/SpamAssassin/Plugin/TxRep.pm =================================================================== --- lib/Mail/SpamAssassin/Plugin/TxRep.pm (revision 1842596) +++ lib/Mail/SpamAssassin/Plugin/TxRep.pm (working copy) @@ -523,7 +523,7 @@ {return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;} elsif ($value !~ /^\d+$/ || $value < 0 || $value > 32) {return $Mail::SpamAssassin::Conf::INVALID_VALUE;} - $self->{txrep_ipv4_mask_len} = $value; + $self->{ipv4_mask_len} = $value; } }); @@ -556,7 +556,7 @@ {return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;} elsif ($value !~ /^\d+$/ || $value < 0 || $value > 128) {return $Mail::SpamAssassin::Conf::INVALID_VALUE;} - $self->{txrep_ipv6_mask_len} = $value; + $self->{ipv6_mask_len} = $value; } });