diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-08-05 21:08:36 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-08-05 21:08:36 +0800 |
commit | 4eca0acb753df91976f54a38ccb3b79a9893a801 (patch) | |
tree | 095f0c6e46b0cfc42137f493756cbf3ce5bd876b /util | |
parent | 817b96d19f820eec588ae12ee61240920d9819e2 (diff) | |
download | pttbbs-4eca0acb753df91976f54a38ccb3b79a9893a801.tar pttbbs-4eca0acb753df91976f54a38ccb3b79a9893a801.tar.gz pttbbs-4eca0acb753df91976f54a38ccb3b79a9893a801.tar.bz2 pttbbs-4eca0acb753df91976f54a38ccb3b79a9893a801.tar.lz pttbbs-4eca0acb753df91976f54a38ccb3b79a9893a801.tar.xz pttbbs-4eca0acb753df91976f54a38ccb3b79a9893a801.tar.zst pttbbs-4eca0acb753df91976f54a38ccb3b79a9893a801.zip |
new filtermail
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2160 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r-- | util/filtermail.pl | 46 |
1 files changed, 23 insertions, 23 deletions
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 |