procmail
[Top] [All Lists]

Re: How to subvert global procmailrc

2004-11-15 22:14:11
When I asked,

Now wait ... is procmail-cyrus-delivery.sh a filter as the current
code you quoted indicates or is it a delivering program as you
imply now? I'm assuming the latter.

Tuc replied,

The script is :

[script deleted because my mail client would mess it up]

So it isn't a filter, and that `f' flag in the old code was a mistake.

Ok, but what if I'm not putting the .procmailrc in a $HOME directory?
I won't be able to in reality, so I need some way to tell it to run
an RC somewhere other than $HOME, and then stop.

You had something like /home/$LGONAME in the original post, so I thought
that was each user's home directory. You could compile procmail to use
/home/$LOGNAME/.procmailrc (or whatever it was) as the default rcfile
for each user.

If there's no /bin/test and procmail needs to invoke a shell to run
 test, add a semicolon to the end of the condition.

I think it will need to invoke a shell.

If /bin/test exists and is either an executable binary or an executable
hash-bang script, procmail won't need to invoke a shell. But let's say
it does (if not, drop the semicolon) ...

  DROPPRIVS=yes

  :0
  * ! ? test -f /usr/local/etc/procmailrcs/$LOGNAME ;
  | /usr/local/cyrus/bin/procmail-cyrus-delivery.sh $LOGNAME

  # privileges have been dropped, so it's safe to SWITCHRC
  SWITCHRC=/usr/local/etc/procmailrcs/$LOGNAME

I'm assuming that the compiled-in value of DEFAULT is sane in case test passes and SWITCHRC fails.

If you don't mind an error message when the individual rcfile is nonexistent or unusble, you can do this and avoid running test (or a shell for it if it needs a shell):

  DROPPRIVS=yes

  # privileges have been dropped, so it's safe to SWITCHRC
  SWITCHRC=/usr/local/etc/procmailrcs/$LOGNAME

  # if we get here, that file must be nonexistent or unreadable
  # or not a plain file
  :0
  | /usr/local/cyrus/bin/procmail-cyrus-delivery.sh $LOGNAME



____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail