3 messages in net.sourceforge.lists.courier-usersRe: [courier-users] bug in xfilter/re...
FromSent OnAttachments
Robert PenzMay 3, 2002 6:48 am 
Roland SchneiderMay 3, 2002 1:43 pm 
Robert PenzMay 3, 2002 2:18 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [courier-users] bug in xfilter/reformailActions...
From:Roland Schneider (list@serv.ch)
Date:May 3, 2002 1:43:40 pm
List:net.sourceforge.lists.courier-users

--Robert Penz wrote on 03.05.2002 15:48 +0200:

Hi!

If I call reformail via xfilter in my maildroprc and the mail contains a ' in the subject I get following error message.

I've escaped the ' but it doesn't work.

let maildrop do the escape.

there is the maillog ( the first line is the same as the line I use for xfilter .. I've just used echo instead of xfilter.

reformail -I'Subject: [VIRUS WARNING: "now.pif"] Spice girls\' vocal concert' sh: -c: line 1: unexpected EOF while looking for matching `'' sh: -c: line 2: syntax error: unexpected end of file maildrop: error writing to filter. maildrop: Unable to filter message. status: deferred

Could be used to execute any command via shell, worse than M$-Outlook :)

This version should be safer, and cares also about missing or long subjects or names:

VERBOSE="1" import SENDER import RECIPIENT

if ( /^content-type:[:space:]*![:alnum:]+!.*/:h ) { TYPE=$MATCH2 TYPE2=$MATCH3 FILENAME=""

BADEXT="(scr)|(exe)|(com)|(bat)|(pif)|(lnk)|(sys)|(wav)|(mid)|(vb)|(js)|(ws)|(s hs)"

if ( "$TYPE" =~ /multipart/ ) # grep body { if( /^((content-)|([:space:])).*[:space:](file)?name=!.*\.($BADEXT).*$/:b ) FILENAME=escape(substr($MATCH2,0,32)) } else # check header { if ( $TYPE2 =~ /[:space:](file)?name=!.*\.($BADEXT).*$/ ) FILENAME=escape(substr($MATCH2,0,32)) }

if ( "$FILENAME" ) { if ( /^Subject: !.*/:h ) SUBJECT=escape(substr($MATCH2,0,64)) else SUBJECT="(No Subject)"

echo "X-Content-Virus-Warning: $FILENAME <$SENDER> $RECIPIENT $SUBJECT"

xfilter "reformail -A'X-Content-Filter: name=*.$BADEXT' \ -A'X-Content-Scanner: postmaster@$HOSTNAME' \ -A'X-Content-Virus-Warning: $FILENAME <$SENDER> $RECIPIENT' \ -i'Subject: [VIRUS WARNING: $FILENAME] $SUBJECT'" }