~ubuntu-branches/ubuntu/utopic/spamassassin/utopic-updates

« back to all changes in this revision

Viewing changes to lib/Mail/SpamAssassin/AutoWhitelist.pm

  • Committer: Package Import Robot
  • Author(s): Noah Meyerhans
  • Date: 2014-02-14 22:45:15 UTC
  • mfrom: (0.8.1) (0.6.2) (5.1.22 sid)
  • Revision ID: package-import@ubuntu.com-20140214224515-z1es2twos8xh7n2y
Tags: 3.4.0-1
* New upstream version! (Closes: 738963, 738872, 738867)
* Scrub the environment when switching to the debian-spamd user in
  postinst and cron.daily. (Closes: 738951)
* Enhancements to postinst to better manage ownership of
  /var/lib/spamassassin, via Iain Lane <iain.lane@canonical.com>
  (Closes: 738974)

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
use bytes;
47
47
use re 'taint';
48
48
 
49
 
use NetAddr::IP 4.000;   # qw(:upper);
 
49
use NetAddr::IP 4.000;
50
50
 
51
51
use Mail::SpamAssassin;
52
52
use Mail::SpamAssassin::Logger;
123
123
  my ($self, $addr, $origip, $signedby) = @_;
124
124
 
125
125
  if (!defined $self->{checker}) {
126
 
    return undef;               # no factory defined; we can't check
 
126
    return;             # no factory defined; we can't check
127
127
  }
128
128
 
129
129
  $self->{entry} = undef;
192
192
  my ($self,$score) = @_;
193
193
 
194
194
  if (!defined $self->{checker}) {
195
 
    return undef;               # no factory defined; we can't check
 
195
    return;             # no factory defined; we can't check
196
196
  }
197
197
  if ($score != $score) {
198
198
    warn "auto-whitelist: attempt to add a $score to AWL entry ignored\n";
199
 
    return undef;               # don't try to add a NaN
 
199
    return;             # don't try to add a NaN
200
200
  }
201
201
 
202
202
  $self->{entry}->{count} ||= 0;
248
248
  my ($self, $addr, $score, $signedby) = @_;
249
249
 
250
250
  if (!defined $self->{checker}) {
251
 
    return undef;               # no factory defined; we can't check
 
251
    return;             # no factory defined; we can't check
252
252
  }
253
253
 
254
254
  my $fulladdr = $self->pack_addr ($addr, undef);
275
275
sub finish {
276
276
  my $self = shift;
277
277
 
278
 
  if (!defined $self->{checker}) { return undef; }
 
278
  return  if !defined $self->{checker};
279
279
  $self->{checker}->finish();
280
280
}
281
281
 
314
314
    my $origip_obj = NetAddr::IP->new6($origip . '/' . $mask_len);
315
315
    if (!defined $origip_obj) {  # invalid IPv6 address
316
316
      dbg("auto-whitelist: bad IPv6 address $origip");
317
 
    } else {
 
317
    } elsif (NetAddr::IP->can('full6')) {  # since NetAddr::IP 4.010
318
318
      $result = $origip_obj->network->full6;  # string in a canonical form
319
319
      $result =~ s/(:0000){1,7}\z/::/;        # compress zero tail
320
320
    }