~ubuntu-branches/ubuntu/utopic/spamassassin/utopic-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2012-09-07 12:05:50 UTC
  • mfrom: (5.1.16 sid)
  • Revision ID: package-import@ubuntu.com-20120907120550-vkk59m0zpbzsyzjs
Tags: 3.3.2-4ubuntu1
* Merge from Debian unstable (LP: #1040274), remaining changes:
  - Add debian/patches/90_missing_tld to restore missing tld that was
    inadvertently dropped from the list upstream
* debian/spamassassin.postinst: change upgrade version check from
  "<= 3.3.2-2" to "< 3.3.2-3~". This is necessary for upgrades from
  precise.

Show diffs side-by-side

added added

removed removed

Lines of Context:
794
794
  my $in_body = 0;
795
795
  my $header;
796
796
  my $part_array;
 
797
  my $found_end_boundary;
797
798
 
798
799
  my $line_count = @{$body};
799
800
  foreach ( @{$body} ) {
800
801
    # if we're on the last body line, or we find any boundary marker,
801
802
    # deal with the mime part
802
 
    if ( --$line_count == 0 || (defined $boundary && /^--\Q$boundary\E(?:--)?\s*$/) ) {
 
803
    $found_end_boundary = defined $boundary && /^--\Q$boundary\E(?:--)?\s*$/;
 
804
    if ( --$line_count == 0 || $found_end_boundary ) {
803
805
      my $line = $_; # remember the last line
804
806
 
 
807
      # If at last line and no end boundary found, the line belongs to body
 
808
      # TODO:
 
809
      #  Is $self->{mime_boundary_state}->{$boundary}-- needed here?
 
810
      #  Could "missing end boundary" be a useful rule? Mark it somewhere?
 
811
      #  If SA processed truncated message from amavis etc, this could also
 
812
      #  be hit legimately..
 
813
      if (!$found_end_boundary) {
 
814
        # TODO: This is duplicate code from few pages down below..
 
815
        while (length ($_) > MAX_BODY_LINE_LENGTH) {
 
816
          push (@{$part_array}, substr($_, 0, MAX_BODY_LINE_LENGTH)."\n");
 
817
          substr($_, 0, MAX_BODY_LINE_LENGTH) = '';
 
818
        }
 
819
        push ( @{$part_array}, $_ );
 
820
      }
805
821
      # per rfc 1521, the CRLF before the boundary is part of the boundary:
806
822
      # NOTE: The CRLF preceding the encapsulation line is conceptually
807
823
      # attached to the boundary so that it is possible to have a part
810
826
      # CRLFs preceding the encapsulation line, the first of which is part
811
827
      # of the preceding body part, and the second of which is part of the
812
828
      # encapsulation boundary.
813
 
      if ($part_array) {
 
829
      elsif ($part_array) {
814
830
        chomp( $part_array->[-1] );  # trim the CRLF that's part of the boundary
815
831
        splice @{$part_array}, -1 if ( $part_array->[-1] eq '' ); # blank line for the boundary only ...
816
832
      }