Re: [exim] transport_filter and expansion

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Stian Jordet
Data:  
Para: exim-users
Assunto: Re: [exim] transport_filter and expansion
man, 16,.01.2006 kl. 09.30 +0000, skrev Philip Hazel:
> On Mon, 16 Jan 2006, Stian Jordet wrote:
>
> > I'm trying to achieve this:
> >
> > transport_filter = '${if eq{$acl_m2}{spam}{/usr/bin/spamc -U /var/run/spamd.sock -u $acl_m1}{/bin/cat}}'
> >
> > But I get:
> >
> > 2006-01-16 00:15:11 1EyH2p-0002Fy-E1 == ingvild@???
> > <ingvild@???> R=local_user T=maildir_home defer (-24): transport
> > filter process failed (127) while writing to
> > tmp/1137366911.H620387P9050.buick.jordet.net: unable to execute command
> >
> > I understand that this is because of the whitespace in the command. I've
> > tried every way of escaping I know of, but it seems impossible to have
> > both the "${if" and the command escaped correctly.
> >
> > Is this impossible, or does it only seem so?
>
> Hmm. I see the problem. By adopting the same rules as for pipe commands,
> Exim has made it hard to do what you want. If Exim abandoned the
> transport filter on an expansion failure, it could be possible directly,
> but unfortunately, it does not. The only solution may be to interpose
> some intermediate script, but that puts up the resource usage. You could
> use a shell:
>
>   transport_filter = /bin/sh -c \
>     '${if eq{$acl_m2}{spam}{/usr/bin/spamc -U /var/run/spamd.sock -u $acl_m1}{/bin/cat}}'


Thanks, this works :)

> Alternatively, do it at a higher level. Have two transports, one with
> the transport filter and one without. Then in the router, you can have
>
>   transport = ${if eq{$acl_m2}{spam}{transport_with_filter}\
>               {transport_without_filter}}

>
> That might be easiest, and what's more, when you don't need a transport
> filter, you don't have the extra expense of running /bin/cat as a null
> filter.


This would have worked, but I have at least three different transports I
want to use this on, would like to avoid having two copies of them. More
things to break, then.

But you should consider a "transport_filter_condition", which would have
solved all the problems in a fine way :)

Anyway, thanks a lot for Exim!

Best regards,
Stian