系统:Debian Jessie
我正在尝试在 sql 配置中放置一个环境变量,例如:
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'
我的变量是
%{env:CLUSTERNAME}
CLUSTERNAME 通过 /etc/default/dovecot 设置。我尝试将 import_environment 配置变量设置为
TZ CLUSTERNAME
但这并没有改变。
当我通过登录尝试执行此操作时,我在 tcpflow 输出中看到以下内容:
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'
所以
%{env:CLUSTERNAME}
被解析为
env:CLUSTERNAME}
这不是文档(http://wiki.dovecot.org/Variables)所说的,而且解析器似乎也以某种方式将其视为一个短变量(删除 %+{)。
任何提示这里可能发生的事情/我如何使它工作?