[exim] set macro only if virtual user exists in ldap backend

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Jonas Meurer
Dátum:  
Címzett: exim-users
Tárgy: [exim] set macro only if virtual user exists in ldap backend
hello,

i have the following configuration to grep virtual user accounts
from ldap:

---snip exim4.conf ---
ldap_default_servers = 127.0.0.1::389
BASEDN = ou=mail,ou=accounts,dc=resivo,dc=mejo,dc=net
GET_ADDRESS_DATA = ${lookup ldap \
    {ldap:///BASEDN??sub?(&(uid=${quote_ldap:$local_part}@${quote_ldap:$domain}))}}


lookup:
driver = redirect
address_data = GET_ADDRESS_DATA
# data is intentionally left blank so that the router will decline
# we just want this router to do a lookup so the results are availble
# for the other routers.
data =

localdelivery:
driver = accept
condition = ${if match
{${extract{uid}{$address_data}}}{$local_part@$domain} {1}{0}}
user = mail
group = mail
transport = maildir_home
---snip exim4.conf ---


as i use debian's exim4, and the maildir_home delivery there supports
the macro MAILDIR_HOME_MAILDIR_LOCATION.
i'dd like to set this one to ${extract{mailMessageStore}{$address_data}}
whenever the appropriate virtual user exists in ldap.

i already tried the following:

.ifdef ${extract{mailMessageStore}{$address_data}}
MAILDIR_HOME_MAILDIR_LOCATION = ${extract{mailMessageStore}{$address_data}}
.endif

unfortunately it doesn't work and always sets an empty
MAILDIR_HOME_MAILDIR_LOCATION macro.

if i set the macro without any ifdef condition it is set even if no
ldap entry exists for the virtual user. this makes routers later in the
configuration useless.

any suggestions about how to set the MAILDIR_HOME_MAILDIR_LOCATION macro
only if a appropriate ldap user exists?

bye
jonas