procmail
[Top] [All Lists]

Re: MIME attachment killer won't work

2000-01-12 15:36:48
* Tue 2000-01-11 Jon Walthour <jonw(_at_)one(_dot_)net> list.procmail
* Message-Id: <20000111063549(_dot_)A974(_at_)one(_dot_)net>
|
| One last question, and then I'll stop beating this dead horse. What
| would you do with a similar sort of attachment: a v-card. It looks
| similar to the WINMAIL.DAT attachment (which, as you say, aren't
| MIME attachments at all, but uuencoded attachments. Anyway, it looks
| like this:
| 
| begin 600 <somebody's name>.vcf
| M0D5'24XZ5D .... (more glibberish)

This looks like oldie goldie UUENCODE, not MIME

| In procmail-ese, how would you say, in effect "Find 'begin 600
| *.vcf' then cut everything out until you get to a line that just
| says 'end'" (The * in this case being a wildcard)?

Era's sed solution is most appropriate here.

| >   1995  "tnef" data in an uuencoded WINMAIL.DAT "attachment"
| >   1996  "tnef" data as application/octet-stream MIME attachment
| >   1997  "tnef" data as application/ms-tnef (or whatever) MIME attachment

You know the story why I cared to write the attachement killer?
The company changed to Exchange and Lotus mail programs and
I was really unhappy with mail in Unix account at that time!

| > A MIME attachment, which is what Jari's module can handle (as far as I
| > know) looks roughly like this:
| > 
| >     --0123456789stringofgibberish
| > 
| >     ZXZlbiBtb3JlIGdpYmJlcmlzaCwgdG8gYm9vdA= ...

Yes. It must be true MIME and that gets checked several times.

MAKE NO MISTAKE -- The pm-jamime-kill.rc is meant to handle VERY
SIMPLE MIME ATTACHEMENTS. It was never meant to tackle complex
multipart mime messages. 

To do MIME right, you would need heavy powered tools like metamail or Perl
mime modules, but that's too expensive and I decided to use
simple recipe and resource friendly AWK, which is almost as portable
as /bin/sh scripts

| > 
| >     :0BD fwb
| >     * ^begin 600 WINMAIL\.DAT$
| >     | sed -e '/^begin 600 WINMAIL\.DAT$/,/^end$/d'

Yes. This is the right thing. You could make it a general 
UUENCODE killer easily

    :0 BD fb w
    *  H ?? Match-those-MUAs-that-send-idiotic-UU
    | sed -e '/^begin 600 [A-Za-z.-].*[A-Za-z.-]$/,/^end$/d'
                           =====================

Change the regexps to your liking. I don't know if the Headers
give enough clues to plug-it on effect for those MUAs, but
the idea was that.

jari

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