Mailing List Archive

svn commit: r453586 [2/7] - in /spamassassin/branches/jm_re2c_hacks: ./ build/ build/automc/ build/buildbot/ contrib/ lib/Mail/ lib/Mail/SpamAssassin/ lib/Mail/SpamAssassin/Bayes/ lib/Mail/SpamAssassin/BayesStore/ lib/Mail/SpamAssassin/Conf/ lib/Mail/S...
Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/BayesStore/SQL.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/BayesStore/SQL.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/BayesStore/SQL.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/BayesStore/SQL.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Client.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Client.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Client.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Client.pm Fri Oct 6 05:46:56 2006
@@ -1,10 +1,11 @@
# NOTE: This interface is alpha at best, and almost guaranteed to change
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -134,6 +135,7 @@
print $remote "$EOL";

my $line = <$remote>;
+ return undef unless (defined $line);

my ($version, $resp_code, $resp_msg) = $self->_parse_response_line($line);

@@ -142,11 +144,7 @@

return undef unless ($resp_code == 0);

- my $found_blank_line_p = 0;
-
- while (!$found_blank_line_p) {
- $line = <$remote>;
-
+ while ($line = <$remote>) {
if ($line =~ /Content-length: (\d+)/) {
$data{content_length} = $1;
}
@@ -155,8 +153,8 @@
$data{score} = $2 + 0;
$data{threshold} = $3 + 0;
}
- elsif ($line =~ /$EOL/) {
- $found_blank_line_p = 1;
+ elsif ($line =~ /^${EOL}$/) {
+ last;
}
}

@@ -245,6 +243,7 @@
print $remote "$EOL";

my $line = <$remote>;
+ return undef unless (defined $line);

my ($version, $resp_code, $resp_msg) = $self->_parse_response_line($line);

@@ -253,22 +252,18 @@

return undef unless ($resp_code == 0);

- my $found_blank_line_p = 0;
-
my $did_set;
my $did_remove;

- while (!$found_blank_line_p) {
- $line = <$remote>;
-
+ while ($line = <$remote>) {
if ($line =~ /DidSet: (.*)/i) {
$did_set = $1;
}
elsif ($line =~ /DidRemove: (.*)/i) {
$did_remove = $1;
}
- elsif ($line =~ /$EOL/) {
- $found_blank_line_p = 1;
+ elsif ($line =~ /^${EOL}$/) {
+ last;
}
}

@@ -312,6 +307,7 @@
print $remote "$EOL";

my $line = <$remote>;
+ return undef unless (defined $line);

my ($version, $resp_code, $resp_msg) = $self->_parse_response_line($line);

@@ -321,16 +317,14 @@
return undef unless ($resp_code == 0);

my $reported_p = 0;
- my $found_blank_line_p = 0;
-
- while (!$reported_p && !$found_blank_line_p) {
- $line = <$remote>;

+ while (($line = <$remote>)) {
if ($line =~ /DidSet:\s+.*remote/i) {
$reported_p = 1;
+ last;
}
- elsif ($line =~ /^$EOL$/) {
- $found_blank_line_p = 1;
+ elsif ($line =~ /^${EOL}$/) {
+ last;
}
}

@@ -370,6 +364,7 @@
print $remote "$EOL";

my $line = <$remote>;
+ return undef unless (defined $line);

my ($version, $resp_code, $resp_msg) = $self->_parse_response_line($line);

@@ -379,16 +374,14 @@
return undef unless ($resp_code == 0);

my $revoked_p = 0;
- my $found_blank_line_p = 0;
-
- while (!$revoked_p && !$found_blank_line_p) {
- $line = <$remote>;

+ while (!$revoked_p && ($line = <$remote>)) {
if ($line =~ /DidRemove:\s+remote/i) {
$revoked_p = 1;
+ last;
}
- elsif ($line =~ /^$EOL$/) {
- $found_blank_line_p = 1;
+ elsif ($line =~ /^${EOL}$/) {
+ last;
}
}

@@ -420,10 +413,10 @@

my $line = <$remote>;
close $remote;
+ return undef unless (defined $line);

my ($version, $resp_code, $resp_msg) = $self->_parse_response_line($line);
-
- return 0 unless ($resp_msg =~ /^PONG/);
+ return 0 unless ($resp_msg eq 'PONG');

return 1;
}
@@ -483,6 +476,7 @@
sub _parse_response_line {
my ($self, $line) = @_;

+ $line =~ s/\r?\n$//;
return split(/\s+/, $line, 3);
}


Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -815,8 +816,18 @@
default => 'test',
code => sub {
my ($self, $key, $value, $line) = @_;
- if ($value !~ /^(yes|no|test|test:\s+.+)$/) { return $INVALID_VALUE; }
- $self->{dns_available} = ($1 or "test");
+ if ($value =~ /^test(?::\s+.+)?$/) {
+ $self->{dns_available} = $value;
+ }
+ elsif ($value =~ /^(?:yes|1)$/) {
+ $self->{dns_available} = 'yes';
+ }
+ elsif ($value =~ /^(?:no|0)$/) {
+ $self->{dns_available} = 'no';
+ }
+ else {
+ return $INVALID_VALUE;
+ }
}
});

@@ -3015,8 +3026,7 @@

sub finish {
my ($self) = @_;
- delete $self->{parser};
- delete $self->{main};
+ %{$self} = ();
}

###########################################################################

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf/LDAP.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf/LDAP.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf/LDAP.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf/LDAP.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf/Parser.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf/Parser.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf/Parser.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf/Parser.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -57,7 +58,7 @@

- $CONF_TYPE_STRING: string
- $CONF_TYPE_NUMERIC: numeric value (float or int)
- - $CONF_TYPE_BOOL: boolean (0 or 1)
+ - $CONF_TYPE_BOOL: boolean (0/no or 1/yes)
- $CONF_TYPE_TEMPLATE: template, like "report"
- $CONF_TYPE_ADDRLIST: address list, like "whitelist_from"
- $CONF_TYPE_HASH_KEY_VALUE: hash key/value pair,
@@ -240,6 +241,7 @@
local ($1); # bug 3838: prevent random taint flagging of $1

$line =~ s/(?<!\\)#.*$//; # remove comments
+ $line =~ s/\\#/#/g; # hash chars are escaped, so unescape them
$line =~ s/^\s+//; # remove leading whitespace
$line =~ s/\s+$//; # remove tailing whitespace
next unless($line); # skip empty lines
@@ -586,6 +588,16 @@
unless (defined $value && $value !~ /^$/) {
return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;
}
+
+ # bug 4462: allow yes/1 and no/0 for boolean values
+ $value = lc $value;
+ if ($value eq 'yes') {
+ $value = 1;
+ }
+ elsif ($value eq 'no') {
+ $value = 0;
+ }
+
unless ($value =~ /^[01]$/) {
return $Mail::SpamAssassin::Conf::INVALID_VALUE;
}
@@ -981,6 +993,7 @@
my ($self, $name, $re) = @_;

if (!$re || $re !~ /^\s*m?(\W).*(?:\1|>|}|\)|\])[a-z]*\s*$/) {
+ $re ||= '';
$self->lint_warn("config: invalid regexp for rule $name: $re: missing or invalid delimiters\n", $name);
return 0;
}

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf/SQL.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf/SQL.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf/SQL.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Conf/SQL.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Constants.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Constants.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Constants.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Constants.pm Fri Oct 6 05:46:56 2006
@@ -3,11 +3,12 @@
# TODO! we need to reimplement parts of the RESERVED regexp!

# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -264,7 +265,7 @@

# regular expression that matches message separators in The University of
# Washington's MBX mailbox format
-use constant MBX_SEPARATOR => qr/([\s|\d]\d-[a-zA-Z]{3}-\d{4}\s\d{2}:\d{2}:\d{2}.*),(\d+);([\da-f]{12})-(\w{8})/;
+use constant MBX_SEPARATOR => qr/^([\s|\d]\d-[a-zA-Z]{3}-\d{4}\s\d{2}:\d{2}:\d{2}.*),(\d+);([\da-f]{12})-(\w{8})\r?$/;
# $1 = datestamp (str)
# $2 = size of message in bytes (int)
# $3 = message status - binary (hex)

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/DBBasedAddrList.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/DBBasedAddrList.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/DBBasedAddrList.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/DBBasedAddrList.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Dns.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Dns.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Dns.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Dns.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/DnsResolver.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/DnsResolver.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/DnsResolver.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/DnsResolver.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -427,7 +428,9 @@

=item $res->bgabort()

-Call this to release pending requests from memory when aborting backgrounded requests
+Call this to release pending requests from memory, when aborting backgrounded
+requests, or when the scan is complete.
+C<Mail::SpamAssassin::PerMsgStatus::check> calls this before returning.

=cut

@@ -500,10 +503,7 @@
sub finish {
my ($self) = @_;
$self->finish_socket();
- if (!$self->{no_resolver}) {
- delete $self->{res};
- }
- delete $self->{main};
+ %{$self} = ();
}

###########################################################################

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/HTML.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/HTML.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/HTML.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/HTML.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -649,9 +650,6 @@
if ($tag eq "img" && exists $self->{inside}{a} && $self->{inside}{a} > 0) {
$self->{uri}->{$self->{anchor_last}}->{anchor_text}->[-1] .= "<img>\n";
$self->{anchor}->[-1] .= "<img>\n";
- if ($self->{anchor_last} =~ /\.(?:pl|cgi|php|asp|jsp|cfm)\b/i) {
- $self->put_results(anchor_image_bug => 1);
- }
}

if ($tag eq "img" && exists $attr->{width} && exists $attr->{height}) {
@@ -675,12 +673,6 @@
$area = $width * $height;
$self->{image_area} += $area;
}
- # this is intended to match any width and height if they're specified
- if (exists $attr->{src} &&
- $attr->{src} =~ /\.(?:pl|cgi|php|asp|jsp|cfm)\b/i)
- {
- $self->put_results(web_bugs => 1);
- }
}
if ($tag eq "form" && exists $attr->{action}) {
$self->put_results(form_action_mailto => 1) if $attr->{action} =~ /mailto:/i
@@ -750,8 +742,9 @@
}
push @{ $self->{text} }, $text;
while (my ($k, $v) = each %display) {
- $self->{"text_$k"} ||= '';
- vec($self->{"text_$k"}, $#{$self->{text}}, 1) = $v;
+ my $textvar = "text_".$k;
+ if (!exists $self->{$textvar}) { $self->{$textvar} = ''; }
+ vec($self->{$textvar}, $#{$self->{text}}, 1) = $v;
}
}


Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locales.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locales.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locales.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locales.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker/Flock.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker/Flock.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker/Flock.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker/Flock.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker/UnixNFSSafe.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker/UnixNFSSafe.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker/UnixNFSSafe.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker/UnixNFSSafe.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker/Win32.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker/Win32.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker/Win32.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Locker/Win32.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger/File.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger/File.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger/File.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger/File.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger/Stderr.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger/Stderr.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger/Stderr.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger/Stderr.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger/Syslog.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger/Syslog.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger/Syslog.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Logger/Syslog.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/MailingList.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/MailingList.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/MailingList.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/MailingList.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Message.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Message.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Message.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Message.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -515,15 +516,10 @@

# Clean ourself up
$self->finish_metadata();
- undef $self->{pristine_headers};
- undef $self->{pristine_body};
- delete $self->{pristine_headers};
- delete $self->{pristine_body};
- delete $self->{text_decoded};
- delete $self->{text_rendered};

- # Destroy the tree ...
- $self->SUPER::finish();
+ # wipe out all of our pointers and such -- since our tree is one-way, wiping
+ # out body_parts here will wipe out the rest of the tree.
+ %{$self} = ();
}

# ---------------------------------------------------------------------------
@@ -590,30 +586,35 @@
$self->_parse_normal($toparse);

if ($toparse->[0]->{'type'} =~ /^message\b/i && ($toparse->[3] > 0)) {
- # Get the part ready...
- my $message = $toparse->[0]->decode();
+ # Just decode the part, but we don't care about the result here.
+ $toparse->[0]->decode(0);

# Ok, so this part is still semi-recursive, since M::SA::Message calls
# M::SA::Message, but we don't subparse the new message, and pull a
# sneaky "steal our child's queue" maneuver to deal with it on our own
- # time.
- if ($message) {
- my $msg_obj = Mail::SpamAssassin::Message->new({
- message => $message,
- parsenow => 0,
- normalize => $self->{normalize},
- subparse => $toparse->[3]-1,
- });
-
- # Add the new message to the current node
- $toparse->[0]->add_body_part($msg_obj);
-
- # now this is the sneaky bit ... steal the sub-message's parse_queue
- # and add it to ours. then we'll handle the sub-message in our
- # normal loop and get all the glory. muhaha. :)
- push(@{$self->{'parse_queue'}}, @{$msg_obj->{'parse_queue'}});
- delete $msg_obj->{'parse_queue'};
- }
+ # time. Reference the decoded array directly since it's faster.
+ #
+ my $msg_obj = Mail::SpamAssassin::Message->new({
+ message => $toparse->[0]->{'decoded'},
+ parsenow => 0,
+ normalize => $self->{normalize},
+ subparse => $toparse->[3]-1,
+ });
+
+ # Add the new message to the current node
+ $toparse->[0]->add_body_part($msg_obj);
+
+ # now this is the sneaky bit ... steal the sub-message's parse_queue
+ # and add it to ours. then we'll handle the sub-message in our
+ # normal loop and get all the glory. muhaha. :)
+ push(@{$self->{'parse_queue'}}, @{$msg_obj->{'parse_queue'}});
+ delete $msg_obj->{'parse_queue'};
+
+ # Ok, we've subparsed, so go ahead and remove the raw and decoded
+ # data because we won't need them anymore (the tree under this part
+ # will have that data)
+ delete $toparse->[0]->{'raw'};
+ delete $toparse->[0]->{'decoded'};
}
}
}
@@ -806,8 +807,31 @@
$msg->{'name'} = $ct[3];
}

- $msg->{'raw'} = $body;
$msg->{'boundary'} = $boundary;
+
+ # If the part type is not one that we're likely to want to use, go
+ # ahead and write the part data out to a temp file -- why keep sucking
+ # up RAM with something we're not going to use?
+ #
+ if ($msg->{'type'} !~ m@^(?:text/(?:plain|html)$|message\b)@) {
+ my $filepath;
+ ($filepath, $msg->{'raw'}) = Mail::SpamAssassin::Util::secure_tmpfile();
+
+ if ($filepath) {
+ # The temp file was created, let's try to delete it now
+ if (!unlink $filepath) {
+ # We couldn't delete the file, so abort trying to make the temp file.
+ close($msg->{'raw'});
+ unlink $filepath; # try again with the file closed
+ }
+ $msg->{'raw'}->print(@{$body});
+ }
+ }
+
+ # if the part didn't get a temp file, go ahead and store the data in memory
+ if (!exists $msg->{'raw'}) {
+ $msg->{'raw'} = $body;
+ }
}

# ---------------------------------------------------------------------------
@@ -820,7 +844,7 @@
$self->{text_rendered} = [];

# Find all parts which are leaves
- my @parts = $self->find_parts(qr/^(?:text|message)\b/i,1);
+ my @parts = $self->find_parts(qr/./,1);
return $self->{text_rendered} unless @parts;

# the html metadata may have already been set, so let's not bother if it's
@@ -848,9 +872,6 @@
$self->{metadata}->{html} = $p->{html_results};
}
}
- else {
- $text .= $p->decode();
- }
}

# whitespace handling (warning: small changes have large effects!)
@@ -880,7 +901,7 @@
$self->{text_visible_rendered} = [];

# Find all parts which are leaves
- my @parts = $self->find_parts(qr/^(?:text|message)\b/i,1);
+ my @parts = $self->find_parts(qr/./,1);
return $self->{text_visible_rendered} unless @parts;

# the html metadata may have already been set, so let's not bother if it's
@@ -908,9 +929,6 @@
$self->{metadata}->{html} = $p->{html_results};
}
}
- else {
- $text .= $p->decode();
- }
}

# whitespace handling (warning: small changes have large effects!)
@@ -934,7 +952,7 @@
$self->{text_invisible_rendered} = [];

# Find all parts which are leaves
- my @parts = $self->find_parts(qr/^(?:text|message)\b/i,1);
+ my @parts = $self->find_parts(qr/./,1);
return $self->{text_invisible_rendered} unless @parts;

# the html metadata may have already been set, so let's not bother if it's
@@ -989,6 +1007,10 @@

# Go through each part
for(my $pt = 0 ; $pt <= $#parts ; $pt++ ) {
+ # bug 4843: skip text/calendar parts since they're usually an attachment
+ # and not displayed
+ next if ($parts[$pt]->{'type'} eq 'text/calendar');
+
push(@{$self->{text_decoded}}, "\n") if ( @{$self->{text_decoded}} );
push(@{$self->{text_decoded}}, $parts[$pt]->decode());
}

Modified: spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Message/Metadata.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Message/Metadata.pm?view=diff&rev=453586&r1=453585&r2=453586
==============================================================================
--- spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Message/Metadata.pm (original)
+++ spamassassin/branches/jm_re2c_hacks/lib/Mail/SpamAssassin/Message/Metadata.pm Fri Oct 6 05:46:56 2006
@@ -1,9 +1,10 @@
# <@LICENSE>
-# Copyright 2004 Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -85,8 +86,7 @@

sub finish {
my ($self) = @_;
- delete $self->{msg};
- delete $self->{strings};
+ %{$self} = ();
}

1;