Environment Variable Expansion

Tim Evers it at niemail.de
Mon Apr 4 09:39:23 UTC 2016


System: Debian Jessie

I'm trying to put an environment variable in the sql config like:

password_query = SELECT userid AS user, crypt AS password, maildir as
userdb_home, 500 as userdb_uid, 500 as userdb_gid FROM local_account
WHERE userid = '%u' and mbox_host = '%{env:CLUSTERNAME}' \
    and ( ( imap_aktiv='1' and '%s'='imap' ) or ( pop_aktiv='1' and
'%s'='pop3' ) or ( sieve_aktiv='1' and '%s'='sieve' ) ) \
    and aktiv_abruf='1'

My variable is

%{env:CLUSTERNAME}

CLUSTERNAME is set through /etc/default/dovecot. I tried setting the
import_environment config variable to

TZ CLUSTERNAME

but that changed nothing.

When I execute this through a login attempt, I see the following in the
tcpflow output:

SELECT userid AS user, crypt AS password, maildir as userdb_home, 508 as
userdb_uid, 503 as userdb_gid FROM local_account WHERE userid = 'te' and
mbox_host = 'env:CLUSTERNAME}' and ( ( imap_aktiv='1' and 'pop3'='imap'
) or ( pop_aktiv='1' and 'pop3'='pop3' ) or ( sieve_aktiv='1' and
'pop3'='sieve' ) ) and aktiv_abruf='1'

So

%{env:CLUSTERNAME}

was parsed to

env:CLUSTERNAME}

which is not what the doc (http://wiki.dovecot.org/Variables) says, and
it also seems like the parser somehow sees this as a short variable
(removing %+{).

Any hints what might be happening here / how I can make it work.

Regards,

Tim


More information about the dovecot mailing list