procmail
[Top] [All Lists]

alpha testers wanted: procmail with perl extensions

1997-06-17 22:25:00
I have hacked a copy of procmail 3.11 pre 7 to have perl
pattern matching through perlembed.

This has not been massively tested, just compiled on a few different
machines an a few dozen recipes tried a dozen or so times. But it seems
to work well.

I have tried to make this backwards compatible with existing recipes,
so it works a little odd. First off, all of your old recipes will probably
still use the internal pattern matching. Secondly, no capturing to MATCH
is supported (yet). Thirdly the procmail case sensitive regexp flag is
ignored, you have to specify it yourself with /i. You will probably want
/m on all recipes so that ^ and $ work as expected, too.

Here are some sample recipes:

        :0
        * % /^TO_eli\b\@(\w+\.)?netusa/im       # perl processed
        * ^Subject: foo                         # procmail processed
        { ... }
        :0
        * % m,^From:.*[ <](\w+)\(_at_)\1\b,m            # perl processed
        * !% m,^From:(_dot_)*\bfriend\(_at_)friend,im   # perl processed
        { ... }
        :0
        * % m/^From:(_dot_)*?\(_at_)[\w-]{13,}[.]/m     # perl processed
        { ... }

As you can see, % works to say 'perl does this' like a $ works to
say 'expand variables on this'. The procmail ^TO, etc still get
expanded in the same manner. You must use proper perl syntax for
a pattern match. Internally it gets expanded to

        return $string =~ <your-expression-here>

Which *will* pose security leaks for people who don't want procmail
to be able to fork a shell.

Known bugs and problems:
        No documentation
        Autoconfigure only works if you have perl5.004
        'procmail -v' does not report it being different
        I don't really understand procmail's code yet so, I have
                near 100% confidence this will core dump in scoring
                recipes that try to use perl
        Autoconfigure might not get libaries in the right order
        Not for the faint-of-code :^)

To do:
        Documentation
        Some sort of access to stuff captured in perl parens
        :0f equiv. through perl s///
        Internal pipe to arbitrary perl commands
        Check to see if/how /x works

<URL:ftp://ftp.netusa.net/users/eli/procmail3.11p7-perl.tar.gz>

Elijah
------
Please do not CC me when replying to the list.  It is not my responsibility to
prove to you my mail is not spam, if mail to you bounces it will not be resent.

<Prev in Thread] Current Thread [Next in Thread>
  • alpha testers wanted: procmail with perl extensions, Eli the Bearded <=