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

« back to all changes in this revision

Viewing changes to lib/Mail/SpamAssassin/Plugin/MIMEEval.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:
227
227
  $pms->{mime_checked_attachments} = 1;
228
228
 
229
229
  # results
230
 
  $pms->{mime_base64_blanks} = 0;
 
230
# $pms->{mime_base64_blanks} = 0;  # expensive to determine, no longer avail
231
231
  $pms->{mime_base64_count} = 0;
232
232
  $pms->{mime_base64_encoded_text} = 0;
233
233
  # $pms->{mime_base64_illegal} = 0;
275
275
    $part_type[$part] = $ctype;
276
276
    $part_bytes[$part] = 0 if $cd !~ /attachment/;
277
277
 
 
278
    my $cte_is_base64 = $cte =~ /base64/i;
278
279
    my $previous = '';
279
280
    foreach (@{$p->raw()}) {
280
 
      if ($cte =~ /base64/i) {
281
 
        if ($previous =~ /^\s*$/ && /^\s*$/) {
282
 
          $pms->{mime_base64_blanks} = 1;
283
 
        }
284
 
        # MIME_BASE64_ILLEGAL: now a zero-hitter
285
 
        # if (m@[^A-Za-z0-9+/=\n]@ || /=[^=\s]/) {
286
 
        # $pms->{mime_base64_illegal} = 1;
287
 
        # }
288
 
      }
 
281
 
 
282
    # if ($cte_is_base64) {
 
283
    #   if ($previous =~ /^\s*$/ && /^\s*$/) {  # expensive, avoid!
 
284
    #     $pms->{mime_base64_blanks} = 1;  # never used, don't bother
 
285
    #   }
 
286
    #   # MIME_BASE64_ILLEGAL: now a zero-hitter
 
287
    #   # if (m@[^A-Za-z0-9+/=\n]@ || /=[^=\s]/) {
 
288
    #   # $pms->{mime_base64_illegal} = 1;
 
289
    #   # }
 
290
    # }
289
291
 
290
292
      # if ($pms->{mime_html_no_charset} && $ctype eq 'text/html' && defined $charset) {
291
293
      # $pms->{mime_html_no_charset} = 0;
297
299
 
298
300
      if ($where != 1 && $cte eq "quoted-printable" && ! /^SPAM: /) {
299
301
        # RFC 5322: Each line SHOULD be no more than 78 characters,
300
 
        #           excluding the CRLF
 
302
        #           excluding the CRLF.
301
303
        # RFC 2045: The Quoted-Printable encoding REQUIRES that
302
304
        #           encoded lines be no more than 76 characters long.
303
305
        # Bug 5491: 6% of email classified as HAM by SA triggered the
454
456
 
455
457
sub get_charset_from_ct_line {
456
458
  my $type = shift;
457
 
  if (!defined $type) { return undef; }
 
459
  if (!defined $type) { return; }
458
460
  if ($type =~ /charset="([^"]+)"/i) { return $1; }
459
461
  if ($type =~ /charset='([^']+)'/i) { return $1; }
460
462
  if ($type =~ /charset=(\S+)/i) { return $1; }
461
 
  return undef;
 
463
  return;
462
464
}
463
465
 
464
466
# came up on the users@ list, look for multipart/alternative parts which
510
512
    my $cte = lc($p->get_header('content-transfer-encoding') || '');
511
513
    next if ($cte !~ /^base64$/);
512
514
    foreach my $l ( @{$p->raw()} ) {
513
 
      my $len = length $l;
514
 
      $result = $len if ($len > $result);
 
515
      $result = length $l  if length $l > $result;
515
516
    }
516
517
  }
517
518