procmail
[Top] [All Lists]

Re: procmailrc and .procmailrc

1999-04-01 23:59:43
Azfar Kazmi <oup2(_at_)cyber(_dot_)net(_dot_)pk> writes:
...
Okay. Let's work on recipes:

If a recipe in global procmailrc says:

:0
{
       :0 c
       ! boss(_at_)mydomain(_dot_)com
}


and a local recipe for a user [says myself] says:

:0
* !^From:.*ajordomo
* !^From:.*myself
* !^From:.*Automatic*
{
       :0 c
       ! boss(_at_)mydomain(_dot_)com
}

then, will a copy of a mail from Majordomo and received by user myself be
sent to boss(_at_)mydomain(_dot_)com?

Yes.  The /etc/procmailrc file is parsed and executed before procmail
even looks for a $HOME/.procmailrc file.  Nothing in the
$HOME/.procmailrc can effect the processing of the /etc/procmailrc file
unless the /etc/procmailrc checks for the $HOME/.procmailrc file
itself.


What I want is that, then, it should not, means that local recipe
suppresses the global one.

Obviously the customized changes will be for few users and not whole
community. Therefore, what seems logical is that local recipes MUST act no
matter what global ones say.

The only way I see to do this would be to have the /etc/procmailrc file
do an explicit INCLUDERC of a specified file in the user's home
directory.  I would *not* use $HOME/.procmailrc for this as it would
just confuse that file's purpose.  I would instead suggest putting the
per-user overrides in a file called something like
$HOME/.procmailrc.override, or $HOME/.procmailrc.pre, or something like
that.  The /etc/procmailrc would then include code along the lines of

        # We're going to be reading in the user's file, so drop privileges now
        # Not doing this would allow any user to become root.  Think about that.
        DROPPRIVS = yes

        # Try to include $HOME/.procmailrc.override  Don't bother testing,
        # just go for it.  Procmail will simply ignore the next line if
        # the file doesn't exist.
        INCLUDERC = $HOME/.procmailrc.override

        # At this point, do any global filtering.  Recipes that are overridable
        # should check a variable that would be setable from the above
        # include file, and modify their behavior as needed.

        # If nothing in the $HOME/.procmailrc.override or /etc/procmailrc
        # delivers the message but rather processing falls off the end of
        # the /etc/procmailrc, processing will continue with the user's
        # $HOME/.procmailrc file.

Got it?

Philip Guenther

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