RE: [Exim] .forward and pipe modified message

Top Page
Delete this message
Reply to this message
Author: Dan Muey
Date:  
To: exim-users
Subject: RE: [Exim] .forward and pipe modified message
> On Wed, 3 Sep 2003, Dan Muey wrote:
>
> > In a user's .forwadr file:
> >
> > #Exim Filter
> > pipe "/path/to/mailfilter email@???"
> >
> > This will give the email for the user to STDIN of
> /path/to/mailfilter
> > with email@??? as /path/to/mailfilter's argument? Correct?
>
> Yes.
>
> > So my question is if I exit(1); from /path/to/mailfilter (a perl
> > script) then that tells exim that the pipe failed and the
> message goes
> > to the black hole and is never heard from again, and if I exit(0);
> > then it tells exim the pipe was successful and to continue on.
> > Correct?
>
> No. If you exit(1) Exim will assume the delivery failed, and
> will generate a bounce to the sender. If you exit(0) without
> doing anything with the message, you have blackholed it.
>
> > Now the question is this:
> >    How would I get Exim go ahead and deliver the message
> that /path/to/mailfilter creates instead
> >    of the original message on an exit(0);?

>
> Exim is delivering the original message to the pipe. That's
> all it knows. You cannot, at this stage, tell it to deliver
> it anywhere else. If you want Exim to deliver a new
> (modified) message, you must pass the new message to a new
> instance of Exim. In other words, you submit a new message.
> Alternatively, you can pass the message to a local delivery
> agent such as procmail if all you want is a local delivery.


So I can do
# Exim Filter
pipe "/path/to/prog email@??? | /local/delivery/program/like/procmail/or/safecat/etc ARG ARG"
seen finish

And as long as "local_delivery_program_like_procmail_etc" can write it's STDIN to a user's inbox then the output of /path/to/prog will be delivered to the user's inbox, and if /path/to/prog does exit(0); then the message is dropped
Out of the universe forever, is this thinking correct?

Which is the same as doing this in a user's .qmail file:

|/path/to/prog email@??? | /usr/sbin/safecat ARG ARG
exit 99

Thanks for hanging in there with me everyone, I'll get it I swear!

Dan


>
> If you pass a new message to Exim there is a potential
> looping problem. If you are doing this for unprivileged
> users, the best you can probably do is to insert some kind of
> obscure header line that you test (and
> remove) in the filter.
>
>
> --
> Philip Hazel            University of Cambridge Computing Service,
> ph10@???      Cambridge, England. Phone: +44 1223 334714.
> Get the Exim 4 book:    http://www.uit.co.uk/exim-book

>
>