procmail
[Top] [All Lists]

Re: Getting partial matches from a string without forking an outside process

2005-01-10 01:27:02
On Sun, Jan 09, 2005 at 07:33:51PM -0800, Bart Schaefer wrote:
On Sun, 09 Jan 2005 19:39:17 +0100, Dallman Ross <dman(_at_)nomotek(_dot_)com>
wrote:

Okay, but as Ruud showed, once we have our foreshortened string, it's
trivial to then find the right side.

  :0
  * fullstring ?? ^^$\leftpart\/.*
  { rightpart = "$MATCH" }

I tried exactly that approach in my "mimepart" recipe [*] but found
that it does not work when $leftpart contains an embedded newline.  It
appeared (at the time) that what happens is that $\leftpart causes the
newline to be prefixed with a backslash, which when parsed again by
the regex engine is then recognized as a line continuation, causing
the newline itself and any whitespace that follows it to be ignored.

Have you tested your splitter on strings containing embedded newlines?

No, I haven't tried it anywhere except in tests for my post.  I
am sure you are right, though; and I was not trying to design something
that would span newlines.  I was only showing an exercise for a simple
string slicer-dicer.

[*] http://www.well.com/user/barts/email/mimepart.txt

Yeah, I remember.  Thanks.  :)  (Good work.)

If the split function is intended to prove something about whether
a MIME part with code like this is viral:

       name="=?koi8-r?B?UmVjaG51bmcxODc0NTUxNC5j?=
        =?koi8-r?B?aG0=?="

(taken from a sample virus that vsnag 2.23 stopped) I maintain as
I did earlier last month about it: that doing such tests is not
worth the effort.  If you see a message with crap like that in it,
it is not going to be something you need to evaluate to know that
you don't want to download it and click on attachments contained in
it.  Just block it!

Vsnag 2.23 is ready for release but has not actually been released,
except to beta testers.  But that's only because I haven't had time
to write the changes log for it and update the FAQ.  Maybe I can
do that today, though.

-- 
dman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>