--- /root/.cpan/build/Mail-SpamAssassin-2.31/spamproxy/spamproxyd	Wed Jul 24 08:50:07 2002
+++ spamproxyd	Sat Aug  3 17:40:29 2002
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
 
 
 eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
@@ -14,6 +14,7 @@
 my $children = 4;
 my $minperchild = 5;
 my $maxperchild = 10;
+my $maxsize = 80000;
 my $shared=0;
 my $debug=0;
 my $recipient_mapping=0; # name of the file which will be used 
@@ -212,6 +213,19 @@
     
 
     my $message = $client->{MSG};
+
+	my $len = length($client->{MSG});
+	my $tmpMessage = "Message length is : ".$len." chars\n"; 
+	setlogsock 'unix';
+	openlog('spamassassin', 'nowait', 'local3');
+	syslog('notice', $tmpMessage);
+	closelog();
+
+    my $recips;
+    my $msg;
+
+   if ($len < $maxsize)
+   {
     my @msg = split ("\r\n", $message,'-1');
     my $arraycont = @msg; for(0..$arraycont) { $msg[$_] .= "\r\n"; }
     my %args = (data => \@msg);
@@ -231,8 +245,6 @@
     # instead, pass the original message to the smarthost code below.
     # --irj
 
-    my $recips;
-    my $msg;
     my $status = $spamtest->check($mail);
     my @msg_debug;
 
@@ -319,12 +331,32 @@
     # no other modifications to the rest of the distribution (which is
     # required to make this work and is in CPAN).
     # --irj
+    my $relay = new Mail::SpamAssassin::SMTP::SmartHost($client->{FROM},
+                                                 $recips,
+                                                 $message,
+                                                 "$smarthost");
+    
+    } else 
+    {
+
+    my @msg = split ("\r\n", $message,'-1');
+    my $arraycont = @msg; for(0..$arraycont) { $msg[$_] .= "\r\n"; }
+    my %args = (data => \@msg);
+    my $mail = Mail::SpamAssassin::NoMailAudit->new(%args);
+    my $header=join("",$mail->header());
+    my $body=join("",@{$mail->body()});
+    $message = join ("\r\n",$header,$body);
+    print $message,"\n" if $debug>=2;
+    $recips = $client->{TO};
 
     my $relay = new Mail::SpamAssassin::SMTP::SmartHost($client->{FROM},
                                                  $recips,
                                                  $message,
                                                  "$smarthost");
 
+    }
+
+
     # Zap this instance if this child's processing limit has been reached.
     # --irj
     print "mail     delivered port $port\n" if $debug;
@@ -423,6 +455,8 @@
 Bennett Todd for the perforking code and option-parsing code from his
     pacakge, smtpproxy
 
+Alexandre Dulaunoy added size check to bypass for a specified size of the message
+
 Special thanks go out to the crew at my usual IRC hangout, notably Barry
 Hughes, Matti Koskimies, plus a number of others whom I may have not given
 appropriate credit, but you still deserve it.  You've been a big help.  :)

