From fc46abdd9ce3bff29f735142ab52fec4fb1bf8a7 Mon Sep 17 00:00:00 2001 From: rsc Date: Wed, 12 Apr 2006 13:10:08 +0000 Subject: boguszip --- mail/lib/validateattachment | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'mail') diff --git a/mail/lib/validateattachment b/mail/lib/validateattachment index 03d3f0eb..d21044f3 100755 --- a/mail/lib/validateattachment +++ b/mail/lib/validateattachment @@ -5,9 +5,9 @@ rfork n # exit status matching: # -# *discard* - is really bad, refuse the message -# *accept* - is really good, leave attachment alone -# * - rewrite attachment to have .suspect extension +# $discard - is really bad, refuse the message +# $accept - is really good, leave attachment alone +# anything else - rewrite attachment to have .suspect extension # # magic exit statuses known to vf @@ -21,6 +21,15 @@ if(! ~ $#* 1){ exit usage } +# some idiot virus is sending around attachments marked as .zip +# that are completely bogus and just say %TS_ZIP_ATTACH% +# as the base64 encoding of the zip file. gmail rejects all zip +# attachments when we forward them, so nip this one here. +if(grep -s '^%TS_ZIP_ATTACH%$' $1 && ~ `{wc -l <$1} 1 2 3 4 5 6 7 8 9 10){ + echo bogus zip file! + exit $discard +} + upas/unvf < $1 >$1.unvf file=$1.unvf fn sigexit { rm $file } @@ -40,6 +49,7 @@ case *Ascii* *text* *'c program'* *'rc executable'* exit $accept case *'zip archive'* + # >[2=1] because sometimes we get zip files we can't parse # but the errors look like # unzip: reading data for philw.doc.scr failed: ... -- cgit v1.2.3