summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-02-08 12:07:25 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-02-08 12:07:25 +0800
commit2d0a465e3eb0b596e62032b1b5f4f5b07982be12 (patch)
treebd7602dc12c32bca6a2cc9c74f8181cc71161e53
parent87eeae487647486547e88133848143cf284d86bd (diff)
downloadpttbbs-2d0a465e3eb0b596e62032b1b5f4f5b07982be12.tar
pttbbs-2d0a465e3eb0b596e62032b1b5f4f5b07982be12.tar.gz
pttbbs-2d0a465e3eb0b596e62032b1b5f4f5b07982be12.tar.bz2
pttbbs-2d0a465e3eb0b596e62032b1b5f4f5b07982be12.tar.lz
pttbbs-2d0a465e3eb0b596e62032b1b5f4f5b07982be12.tar.xz
pttbbs-2d0a465e3eb0b596e62032b1b5f4f5b07982be12.tar.zst
pttbbs-2d0a465e3eb0b596e62032b1b5f4f5b07982be12.zip
for virus mail
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1511 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--util/filtermail.pl50
1 files changed, 19 insertions, 31 deletions
diff --git a/util/filtermail.pl b/util/filtermail.pl
index c7a728f7..ad349b1c 100644
--- a/util/filtermail.pl
+++ b/util/filtermail.pl
@@ -1,44 +1,32 @@
#!/usr/bin/perl
-if( -e '/usr/bin/mktemp' ){
- $fn = `/usr/bin/mktemp -q /tmp/filtermail.XXXXXXXX`;
-}
-else{
- $fn = `/bin/mktemp -q /tmp/filtermail.XXXXXXXX`;
-}
-chomp $fn;
+# $Id$
+$SaveNoRelay = 0;
$bbsuid = $ARGV[0];
undef @ARGV;
-open FH, ">$fn";
+$msg = '';
$norelay = 0;
+
while( <> ){
- print FH $_;
-# if( ($bbsuid) = $_ =~ /for \<(\w+)\.bbs\@ptt/ ){
-# }
- if( /^Content-Type:/i ){
- $norelay = 1 if( (/multipart/i && !/report/i) || /html/ );
- last;
- }
-}
-while( <> ){
- print FH $_;
+ $msg .= $_;
+
+ $norelay = 1
+ if( (/^Content-Type:/i &&
+ ((/multipart/i && !/report/i) || /html/)) ||
+ /Content-Type: audio\/x-wav; name=\".*.exe\"/ );
}
-close FH;
-if( !$norelay ){
- open FH, "<$fn";
- open OUT, "|/home/bbs/bin/realbbsmail $bbsuid";
- while( <FH> ){
- print OUT $_;
+if( $norelay ){
+ if( $SaveNoRelay ){
+ $fn = `/usr/bin/mktemp -q /tmp/norelay.XXXXXXXX`;
+ open FH, ">$fn";
+ print FH $msg;
+ close FH;
}
- close FH;
- close OUT;
- unlink $fn;
}
else{
- $to = substr($fn, rindex($fn, '/') + 1);
- #`/bin/mv $fn /tmp/norelay/$to`;
- unlink $fn;
+ open OUT, "|/home/bbs/bin/realbbsmail $bbsuid";
+ print OUT $msg;
+ close OUT;
}
-