Mailing List Archive

transport filter arguments/exists fails?
Hello,

Using Exim 4.04 I have the following transport setup:

spamcheck:
driver = pipe
command = /usr/local/exim/bin/exim -oMr spam-scanned -bS
transport_filter = /usr/bin/spamc -f "${if exists \
{TABLES/spam-configs/$local_part} {-C TABLES/spam-configs/$local_part}}"
use_bsmtp
home_directory = /tmp
current_directory = /tmp
user = exim
no_return_path_add
log_output
return_fail_output
message_prefix =
message_suffix =
timeout = 10m

TABLES is a macro. The problem is the -C option to the spamc command in the
transport_filter. (I have modified spamc to cater for '-C' before anyone
says anything!) Exim works fine, but the exists test seems to fail (I
think). If I explicitly change the filter to:

transport_filter = /usr/bin/spamc -f -C TABLES/spam-configs/$local_part

then it all works fine. So permissions to the file isn't a problem, nor are
my mods to spamc.

As usual this is late Friday afternoon, and I am stumped with this. I have
tried using the debug_print transport option but it printed nothing - I need
to investigate this a bit more. If anyone has any ideas/suggestions then I'd
be glad to hear them :-)


Thanks,

John.

------------------------------------------------------------------------
John Horne, University of Plymouth, UK Tel: +44 (0)1752 233914
E-mail: jhorne@plymouth.ac.uk
PGP key available from public key servers
Re: transport filter arguments/exists fails? [ In reply to ]
On 07-Jun-2002 at 15:57:57 John Horne wrote:
> Using Exim 4.04 I have the following transport setup:
> spamcheck:
> driver = pipe
> command = /usr/local/exim/bin/exim -oMr spam-scanned -bS
> transport_filter = /usr/bin/spamc -f "${if exists \
> {TABLES/spam-configs/$local_part} {-C
> TABLES/spam-configs/$local_part}}"
> use_bsmtp
> home_directory = /tmp
> current_directory = /tmp
> user = exim
> no_return_path_add
> log_output
> return_fail_output
> message_prefix =
> message_suffix =
> timeout = 10m
>
> TABLES is a macro. The problem is the -C option to the spamc command in
> the transport_filter. (I have modified spamc to cater for '-C' before
> anyone says anything!) Exim works fine, but the exists test seems to fail
> ? (I think). If I explicitly change the filter to:
>
> transport_filter = /usr/bin/spamc -f -C TABLES/spam-configs/$local_part
>
> then it all works fine. So permissions to the file isn't a problem, nor
> are my mods to spamc.
>
I received no replies to this, but working on it a bit more yesterday it
seems that

transport_filter = /usr/bin/spamc -f "${if exists \
{TABLES/spam-configs/$local_part} {-C TABLES/spam-configs/$local_part}}"

fails whilst

transport_filter = /usr/bin/spamc -f -C "${if exists \
{TABLES/spam-configs/$local_part} {TABLES/spam-configs/$local_part}}"

works fine. (I change spamc to accept -C with or without an following
argument).


Regards,

John.

------------------------------------------------------------------------
John Horne, University of Plymouth, UK Tel: +44 (0)1752 233914
E-mail: jhorne@plymouth.ac.uk
PGP key available from public key servers
Re: transport filter arguments/exists fails? [ In reply to ]
On Wed, 12 Jun 2002, John Horne wrote:

> transport_filter = /usr/bin/spamc -f "${if exists \
> {TABLES/spam-configs/$local_part} {-C TABLES/spam-configs/$local_part}}"
>
> fails whilst
>
> transport_filter = /usr/bin/spamc -f -C "${if exists \
> {TABLES/spam-configs/$local_part} {TABLES/spam-configs/$local_part}}"
>
> works fine. (I change spamc to accept -C with or without an following
> argument).

Exim splits up the command line into separate arguments *before* doing
the string expansions. This is deliberate, so that the contents of any
expansion cannot be treated as meta characters that affect the number of
arguments. [.This may not be a huge issue with transport filters, but it
is important for pipe transports, where you often insert $local_part,
and don't want to have to account for special characters therein.]

The downside is that you can't use an expansion to change the number of
arguments, which is what you were trying to do.



--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.