From 4eca0acb753df91976f54a38ccb3b79a9893a801 Mon Sep 17 00:00:00 2001 From: in2 Date: Thu, 5 Aug 2004 13:08:36 +0000 Subject: new filtermail git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2160 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- util/filtermail.pl | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'util') diff --git a/util/filtermail.pl b/util/filtermail.pl index ad349b1c..1df85b4c 100644 --- a/util/filtermail.pl +++ b/util/filtermail.pl @@ -1,32 +1,32 @@ -#!/usr/bin/perl +#!/usr/local/bin/pperl # $Id$ -$SaveNoRelay = 0; - +use lib qw(/home/bbs/bin/); +use FILTERMAIL; $bbsuid = $ARGV[0]; -undef @ARGV; -$msg = ''; -$norelay = 0; +undef @ARGV; +undef $header; +undef $body; while( <> ){ - $msg .= $_; - - $norelay = 1 - if( (/^Content-Type:/i && - ((/multipart/i && !/report/i) || /html/)) || - /Content-Type: audio\/x-wav; name=\".*.exe\"/ ); + $header .= $_; + last if( $_ =~ /^\n/ ); +} +while( <> ){ + $body .= $_; } -if( $norelay ){ - if( $SaveNoRelay ){ - $fn = `/usr/bin/mktemp -q /tmp/norelay.XXXXXXXX`; - open FH, ">$fn"; - print FH $msg; - close FH; - } +if( FILTERMAIL::checkheader($header) && FILTERMAIL::checkbody($body) ){ + open FH, "|/home/bbs/bin/realbbsmail $bbsuid"; + print FH $header; + print FH $body; + close FH; } -else{ - open OUT, "|/home/bbs/bin/realbbsmail $bbsuid"; - print OUT $msg; - close OUT; +=xxx +else { + $fn = `/usr/bin/mktemp -q /tmp/norelay.XXXXXXXX`; + open FH, ">$fn"; + print FH $msg; + close FH; } +=cut -- cgit v1.2.3