# Patch for Pop3Proxy 1.0 to use it with SpamAssassin 3.0 # # Save this file in your Pop3Proxy directory (where your pop3proxy.pl resists) # and name it pop3proxy.patch. Then open a dos shell and go to your pop3proxy # directory and type in: # patch peerhost . ':' . $peer{$socket}->peerport . " (Server) said $1 to $command\n" if DEBUGGING; - + $snarf_start{$socket} = Time::HiRes::gettimeofday + if TIMERS; # Always include the greeting line in the log. if (DEBUGGING and $command eq 'none') { print $reading_buf{$socket}; @@ -666,6 +667,8 @@ if (substr ($1, 0, 1) eq '+') { if ($command =~ /^TOP$/i and not $allow_top) { print "Snarfing TOP response\n" if DEBUGGING; + $snarf_start{$socket} = Time::HiRes::gettimeofday + if TIMERS; $snarfing{$socket} = TOP; } @@ -854,54 +857,31 @@ # undocumented) add_From_line param set to false. That From_ # kinda breaks the protocol - the client isn't expecting mbox, # he's expecting raw 822 mail - so we leave it out. - my $message = Mail::SpamAssassin::NoMailAudit->new(data => \@mail, - add_From_line => 0); + my $message = Mail::SpamAssassin::Message->new({message => \@mail}); my $start; $start = Time::HiRes::gettimeofday if TIMERS; my $status = $spamtest->check($message); printf "Spam check took %.8f seconds\n", Time::HiRes::gettimeofday - $start if (DEBUGGING and TIMERS); - my $id = $message->get('Message-id') || '*none*'; + my $id = $message->get_pristine_header('Message-id') || '*none*'; print "$bytecount bytes, ", $status->is_spam() ? 'SPAM' : 'NOT spam', ", Message-id: $id\n" if DEBUGGING; print $status->get_report() if DEBUGGING and $respect_byte_count; - $status->rewrite_mail() unless $respect_byte_count; + my $rewritten = $status->rewrite_mail() unless $respect_byte_count; - if ($status->is_spam ()) { - if ($respect_byte_count) { + if ($status->is_spam () and $respect_byte_count) { # DAN - danger, you don't know if you're in the headers or not. $$mailref =~ s/\012Subject: [^\012]{6}/\012Subject: *SPAM*/i or $$mailref =~ s/\012Received: [^\012]{6}/\012Received: *SPAM*/i; } else { - # What as_string() does as of SpamAssassin v2.31: - # return join ('', $self->get_all_headers()) . "\n" . - # join ('', @{$self->get_body()}); $$mailref = $response; - $$mailref .= $message->get_all_headers(); - $$mailref .= "\015\012"; - foreach my $line (@{$message->get_body()}) { - $$mailref .= $line; - } - # SA's markups end with \n instead of CRLF's. Gotta - # change those here. + $$mailref .= $rewritten; $$mailref =~ s|(?get_all_headers(); - $$mailref .= "\015\012"; - foreach my $line (@{$message->get_body()}) { - $$mailref .= $line; - } - # SA's markups end with \n instead of CRLF's. Gotta - # change those here. - $$mailref =~ s|(?finish(); $$mailref =~ s/\012\./\012\.\./g; # byte-stuff }