Re: [exim] Transport command lookup, splitting argv[0] after…

Top Page
Delete this message
Reply to this message
Author: Exim Mailing List
Date:  
To: exim-users
Subject: Re: [exim] Transport command lookup, splitting argv[0] after expansion
On Wed, Sep 30, 2009 at 11:32:06AM +0200, Guillaume Blairon wrote:
> I'm trying to setup a pipe transport with a dbm lookup of its command.
> Apparently, it only works without args because it doesn't split args
> after lookup. Here's an example :
>
> 1 - Create a dbm with a key containing a command with 1 or more args :
> --
> $ perl -e 'dbmopen(my %db, "/tmp/test.db", 0666); $db{test} = "/bin/echo test"; dbmclose(%db);'
>
> 2 - Configure a simple transport looking up this command :
> --
> test_delivery:
> driver = pipe
> command = ${lookup{test}dbmnz{/tmp/test.db}}


The part of the Exim manual that discusses this issue, and the
provided workaround, is in section 29.3:

] The expansion is done in this way, argument by argument, so that the
] number of arguments cannot be changed as a result of expansion, and
] quotes or backslashes in inserted variables do not interact with
] external quoting. However, this leads to problems if you want to
] generate multiple arguments (or the command name plus arguments) from
] a single expansion. In this situation, the simplest solution is to use
] a shell. For example:
]
] command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}

It looks like this should work based on my reading of the docs, so I
would try using:

test_delivery:
driver = pipe
command = /bin/sh -c ${lookup{test}dbmnz{/tmp/test.db}}

--
Dean Brooks
dean@???