procmail
[Top] [All Lists]

Re: MIME attachment killer won't work

2000-01-15 16:41:33
Replying to my own message:

Another problem with this (add to notes on what the recipes can and cannot do), 
and a correction:

 7. The scheme will fail to replace an attachment when the boundary
    contains certain characters which are special to sed. Boundaries can
    contain any of the following characters, with the usual limitation
    that the first character cannot be a space character:

        A-Z a-z 0-9 '()+_,-./=?

    Were a . to appear in the boundary, the sed filter could match
    similar boundaries with a different character in that character
    location. Were a ? to appear, the match will likely fail because sed
    will not see the ? as itself, but as a test for conditional presence
    of the previous character.

    One might try to process the saved variable before passing it to
    sed, \-quoting each ? and ., with a recursive procmail routine or
    an outside program. Procmail's $\VAR capability may help here, but
    not by much, since it \-quotes parens, and you will have to unquote
    them. Perhaps a routine to enclose each character in square brackets
    would suffice.

    I don't know of any flag which can be used in either perl or python
    extensions to disarm metacharacters, so those have no particular
    advantage here.

So, the correction:

    For each occurence of \\? in the sed script, use \\@ instead.

-- 
Rik Kabel      Click *HERE* to lower control rods        
rik(_at_)netcom(_dot_)com