#600007 environment option can not set USER for pipe transport

Package:
exim4
Source:
exim4
Submitter:
Joachim Breitner
Date:
2010-10-14 07:45:03 UTC
Severity:
wishlist
#600007#5
Date:
2010-10-12 18:58:02 UTC
From:
To:
Hi,

I’d like to use deliver (from the dovecot package) in a vhost setup
without having deliver look up information from the dovecot-auth server.
To that end, I need to set the environment variables HOME and USER.
Setting HOME works fine using home_directory. But it seems that I cannot
set USER via the environment option, as in

vuser_sieve:
  driver = pipe
  command = /usr/lib/dovecot/deliver -f $sender_address
  home_directory = /var/vhosts/$domain/$local_part
  environment = USER="$local_part@$domain"

(with or without the quotes, does not matter)

Reading the code (./src/transports/pipe.c, function
pipe_transport_entry), I see that the entries from the environment
option are just appended to the list of environment variables, so I
assume that both values for USER – exim’s default and the one I set –
are passed in the environment, leading to undefined behaviour.

I think it would be better if entries in environment really override the
defaults from exim.

For me, this is not critical, as it only affects the logging output. But
it certainly is unexpected behaviour. Such a setup is also recommended
by dovceot, see the example on http://wiki.dovecot.org/LDA/Exim at the
very bottom.

Thanks,
Joachim


- -- Package-specific info:
Exim version 4.72 #1 built 03-Jun-2010 17:41:48
Copyright (c) University of Cambridge, 1995 - 2007
Berkeley DB: Berkeley DB 4.8.30: (April  9, 2010)
Support for: crypteq iconv() IPv6 GnuTLS move_frozen_messages DKIM
Lookups: lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb dsearch nis nis0 passwd
Authenticators: cram_md5 plaintext
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 8
GnuTLS compile-time version: 2.8.6
GnuTLS runtime version: 2.8.6
Configuration file is /etc/exim4/exim4.conf

- -- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (101, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.35-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages exim4 depends on:
ii  debconf [debconf-2.0]         1.5.36     Debian configuration management sy
ii  exim4-base                    4.72-1     support files for all Exim MTA (v4
ii  exim4-daemon-light            4.72-1     lightweight Exim MTA (v4) daemon

exim4 recommends no packages.

exim4 suggests no packages.

- -- debconf information:
  exim4/drec:
iEYEARECAAYFAky0r7kACgkQ9ijrk0dDIGyIwACbBnnTHQ/Z28qm4YOuF1w+n0aV
huwAmgLSMXIJAnTW4kxOUQqJL9XYlxF2
=N90d
-----END PGP SIGNATURE-----

#600007#14
Date:
2010-10-13 17:10:29 UTC
From:
To:
On 2010-10-12 Joachim Breitner <nomeata@debian.org> wrote:
[...]
[...]

This is also documented. (spec.txt 29.4 Environment variables: "The
environment variables listed below are set up when the command is
invoked. [...] Note that the environment option can be used to add
additional variables [...]")
[...]

I will forward this upstream. Shouldn't this do as a workaround for
the time being?

command = /usr/bin/env USER="$local_part@$domain" /usr/lib/dovecot/deliver -f $sender_address

cu andreas

#600007#19
Date:
2010-10-13 17:12:44 UTC
From:
To:
Hi,

Am Mittwoch, den 13.10.2010, 19:10 +0200 schrieb Andreas Metzler:

yes,  I noticed that it wasn’t working as expected.

Thanks.

Probably. I can also try to use "use_shell", as the shell will probably
re-do the environment and might read it from right to left.

Greetings,
Joachim

#600007#24
Date:
2010-10-14 07:44:15 UTC
From:
To:
Hi again,

Am Mittwoch, den 13.10.2010, 19:12 +0200 schrieb Joachim Breitner:

Confirmed. With “use_shell” the USER in environment takes precedence
over exim’s own one. I assume that this is due to different parsing of
the environment in the shell and in deliver. It works for me this way,
but the behavior is still undesirably arbitrary.

Thanks,
Joachim