|
From: <jgr...@us...> - 2003-07-15 02:43:47
|
Update of /cvsroot/popfile/engine/Classifier
In directory sc8-pr-cvs1:/tmp/cvs-serv22636/Classifier
Modified Files:
Bayes.pm
Log Message:
Fix bug where a very long quarantined message would have the wrong number of terminating dots
Index: Bayes.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v
retrieving revision 1.167
retrieving revision 1.168
diff -C2 -d -r1.167 -r1.168
*** Bayes.pm 11 Jul 2003 21:52:55 -0000 1.167
--- Bayes.pm 15 Jul 2003 02:43:44 -0000 1.168
***************
*** 1197,1210 ****
}
! if ( !$got_full_body ) {
! $self->echo_to_dot_( $mail, $echo?$client:undef, '>>' . $temp_file );
! }
if ( $classification ne 'unclassified' ) {
if ( ( $self->{parameters__}{$classification}{quarantine} == 1 ) && $echo ) {
! print $client "$eol--$temp_file--$eol";
}
}
if ( $echo ) {
print $client "$eol.$eol";
--- 1197,1214 ----
}
! my $before_dot = '';
if ( $classification ne 'unclassified' ) {
if ( ( $self->{parameters__}{$classification}{quarantine} == 1 ) && $echo ) {
! $before_dot = "$eol--$temp_file--$eol";
}
}
+ if ( !$got_full_body ) {
+ $self->echo_to_dot_( $mail, $echo?$client:undef, '>>' . $temp_file, $before_dot );
+ } else {
+ print $client $before_dot if ( $before_dot ne '' );
+ }
+
if ( $echo ) {
print $client "$eol.$eol";
***************
*** 1655,1658 ****
--- 1659,1663 ----
# $client The local mail client (created with IO::) that needs the response
# $file a file to print the response to
+ # $before Optional string to send to client before the dot is sent
#
# echo all information from the $mail server until a single line with a . is seen
***************
*** 1661,1665 ****
sub echo_to_dot_
{
! my ( $self, $mail, $client, $file ) = @_;
# These if statements are repetitive to keep the inner loops efficient
--- 1666,1670 ----
sub echo_to_dot_
{
! my ( $self, $mail, $client, $file, $before ) = @_;
# These if statements are repetitive to keep the inner loops efficient
***************
*** 1673,1683 ****
last if ( $self->{alive_} == 0 );
- print $client $_;
- print FILE $_;
-
# The termination has to be a single line with exactly a dot on it and nothing
# else other than line termination characters. This is vital so that we do
# not mistake a line beginning with . as the end of the block
! last if ( /^\.(\r\n|\r|\n)$/ );
}
close FILE;
--- 1678,1700 ----
last if ( $self->{alive_} == 0 );
# The termination has to be a single line with exactly a dot on it and nothing
# else other than line termination characters. This is vital so that we do
# not mistake a line beginning with . as the end of the block
!
! if ( /^\.(\r\n|\r|\n)$/ ) {
! if ( $before ne '' ) {
! print $client $before;
! print FILE $before;
! }
!
! print $client $_;
! print FILE $_;
!
! last;
! }
!
! print $client $_;
! print FILE $_;
!
}
close FILE;
***************
*** 1689,1698 ****
last if ( $self->{alive_} == 0 );
- print $client $_;
-
# The termination has to be a single line with exactly a dot on it and nothing
# else other than line termination characters. This is vital so that we do
# not mistake a line beginning with . as the end of the block
! last if ( /^\.(\r\n|\r|\n)$/ );
}
} elsif (defined($file)) {
--- 1706,1724 ----
last if ( $self->{alive_} == 0 );
# The termination has to be a single line with exactly a dot on it and nothing
# else other than line termination characters. This is vital so that we do
# not mistake a line beginning with . as the end of the block
!
! if ( /^\.(\r\n|\r|\n)$/ ) {
! if ( $before ne '' ) {
! print $client $before;
! }
!
! print $client $_;
!
! last;
! }
!
! print $client $_;
}
} elsif (defined($file)) {
***************
*** 1704,1713 ****
last if ( $self->{alive_} == 0 );
- print FILE $_;
-
# The termination has to be a single line with exactly a dot on it and nothing
# else other than line termination characters. This is vital so that we do
# not mistake a line beginning with . as the end of the block
! last if ( /^\.(\r\n|\r|\n)$/ );
}
close FILE;
--- 1730,1748 ----
last if ( $self->{alive_} == 0 );
# The termination has to be a single line with exactly a dot on it and nothing
# else other than line termination characters. This is vital so that we do
# not mistake a line beginning with . as the end of the block
!
! if ( /^\.(\r\n|\r|\n)$/ ) {
! if ( $before ne '' ) {
! print FILE $before;
! }
!
! print FILE $_;
!
! last;
! }
!
! print FILE $_;
}
close FILE;
|