procmail
[Top] [All Lists]

Re: Filtering out unwanted mime attachments

1997-10-16 06:00:22
era eriksson writes on 16 October 1997 at 10:21:34
Glad to have helped.  Perhaps we can extend it to accept lines consisting
of nothing but two hyphens or two hyphens and a space so that a .sig sepa-
rator isn't mistaken for a multipart boundary:

         * $ ^--$boundary$\/(.?([^-].*|- ?)?$)+

So this will in fact match any boundary, not just the boundaries in
the message we are presently trying to parse, won't it? I would think

yes it will.  In practice (and for this thread - remember it all
started with HTML multipart messages), David's .sig separator is
probably sufficient.  Nevertheless, it's trivial to make this behave
incorrectly as well:
   --next item--
   Content-Type: text/plain

   this is plain text
   -this is evil
   --
   a sig line above?
   now is the time
   --getting sneaky
   -- 
   another sig line?
   for all good men
   --this is not THE boundary--
   to come to the aid
   --not_THE_boundary_either--
   of their country.
   --next item----

you'll have to grab the separator line from the message header's
Content-Type but when you have that, parsing should be fairly

This seems to be difficult, if not impossible in procmail because
(as David pointed out) MATCH is greedy, thus the last $boundary
matches, not the first one.  Resorting "sed" seems to be the only
solution...unless there is some way to get procmail to parse/match one
line at a time.

   Dan
------------------- message is author's opinion only ------------------
J. Daniel Smith <DanS(_at_)bristol(_dot_)com>        
http://www.bristol.com/~DanS
Bristol Technology B.V.                   +31 33 450 50 50, ...51 (FAX)
Amersfoort, The Netherlands               {info,jobs}(_at_)bristol(_dot_)com