~ubuntu-branches/ubuntu/lucid/spamassassin/lucid-proposed

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Laurent Bigonville, Ubuntu Merge-o-Matic, Laurent Bigonville
  • Date: 2006-07-31 15:40:08 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060731154008-j37ulp5pgfkddegw
Tags: 3.1.3-1ubuntu1
[ Ubuntu Merge-o-Matic ]
* Merge from debian unstable.

[ Laurent Bigonville ]
* fix debian/control.
* drop debian/patches/40_fix_dns_issue.

Show diffs side-by-side

added added

removed removed

Lines of Context:
927
927
  }
928
928
  # then try the trusted ones; the user could have whitelisted a trusted
929
929
  # relay, totally permitted
930
 
  if ($self->{num_relays_trusted} > 0) {
 
930
  # but do not do this if any untrusted relays, to avoid forgery -- bug 4425
 
931
  if ($self->{num_relays_trusted} > 0 && !$self->{num_relays_untrusted} ) {
931
932
    push (@relays, @{$self->{relays_trusted}});
932
933
  }
933
934
 
1235
1236
  # relays, so we can return right now.
1236
1237
  return 0 unless (scalar @ips + scalar @originating > 0);
1237
1238
 
1238
 
  dbg("dns: IPs found: full-external: ".join(", ", @fullips).
 
1239
  dbg("dns: IPs found: full-external: ".join(", ", @fullexternal).
1239
1240
        " untrusted: ".join(", ", @ips).
1240
1241
        " originating: ".join(", ", @originating));
1241
1242
 
1247
1248
    # note that if there's only 1 IP in the untrusted set, do NOT pop the
1248
1249
    # list, since it'd remove that one, and a legit user is supposed to
1249
1250
    # use their SMTP server (ie. have at least 1 more hop)!
1250
 
    if ($set =~ /-notfirsthop$/)
 
1251
    # If name is foo-lastexternal, check only the Received header just before
 
1252
    # it enters our internal networks; we can trust it and it's the one that
 
1253
    # passed mail between networks
 
1254
    if ($set =~ /-(notfirsthop|lastexternal)$/)
1251
1255
    {
1252
1256
      # use the external IP set, instead of the trusted set; the user may have
1253
1257
      # specified some third-party relays as trusted.  Also, don't use
1254
1258
      # @originating; those headers are added by a phase of relaying through
1255
1259
      # a server like Hotmail, which is not going to be in dialup lists anyway.
1256
1260
      @ips = $self->ip_list_uniq_and_strip_private(@fullexternal);
1257
 
      if (scalar @ips > 1) { pop @ips; }
 
1261
      if ($1 eq "lastexternal") {
 
1262
        @ips = (defined $ips[0]) ? ($ips[0]) : ();
 
1263
      } else {
 
1264
        pop @ips if (scalar @ips > 1);
 
1265
      }
1258
1266
    }
1259
1267
    # If name is foo-firsttrusted, check only the Received header just
1260
1268
    # after it enters our trusted networks; that's the only one we can
1517
1525
  return 1 if ($word_len < 3);
1518
1526
 
1519
1527
  if (!$triplets_loaded) {
1520
 
    # take a copy to avoid modifying the real one
1521
 
    my @default_triplets_path = @Mail::SpamAssassin::default_rules_path;
1522
 
    @default_triplets_path = map { s,$,/triplets.txt,; $_; }
1523
 
                                    @default_triplets_path;
1524
 
    my $filename = $self->{main}->first_existing_path (@default_triplets_path);
 
1528
    my $filename = $self->{main}->find_rule_support_file('triplets.txt');
1525
1529
 
1526
1530
    if (!defined $filename) {
1527
1531
      dbg("eval: failed to locate the triplets.txt file");
3099
3103
    next if ($k !~ m%^https?:/*(?:[^\@/]+\@)?\d+\.\d+\.\d+\.\d+%i);
3100
3104
    foreach (@{$v->{anchor_text}}) {
3101
3105
      next if (m%^https:/*(?:[^\@/]+\@)?\d+\.\d+\.\d+\.\d+%i);
3102
 
      return 1 if (m%https:%i);
 
3106
      if (m%https:%i) {
 
3107
        keys %{$self->{html}->{uri_detail}}; # resets iterator, bug 4829
 
3108
        return 1;
 
3109
      }
3103
3110
    }
3104
3111
  }
3105
3112
 
3109
3116
sub check_iframe_src {
3110
3117
  my ($self) = @_;
3111
3118
 
3112
 
  while (my($k,$v) = each %{$self->{html}->{uri_detail}}) {
 
3119
  foreach my $v ( values %{$self->{html}->{uri_detail}} ) {
3113
3120
    return 1 if $v->{types}->{iframe};
3114
3121
  }
3115
3122