[exim] howto set macros depending on ldap request

Top Page
Delete this message
Reply to this message
Author: Jonas Meurer
Date:  
To: exim-users
Subject: [exim] howto set macros depending on ldap request
hello,

i use ldap to manage virtual users and their maildir path.

my routers first check in ldap whether the virtual user exists, and then
set MAILDIR_HOME_MAILDIR_LOCATION to the maildir path. the macro is used
by the maildir_home transport.
the problem is, that i want to set this macro only when a virtual user
exists, but if i do a
MAILDIR_HOME_MAILDIR_LOCATION = ${extract{mailMessageStore}{$address_data}}
the macro is set to '' (empty) when the ldap request is empty. this
breaks all other routers as they use the empty path as maildir path.

i already tried the following to set the macro only when the ldap
request got a result, but it doesn't work:

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

.ifdef $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.

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

bye
jonas