Re: [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: Re: [exim] howto set macros depending on ldap request
On 22/07/2005 Jeremy Harris wrote:
> Jonas Meurer wrote:
> >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.
>
> I don't think you can do that (or at least it's not doing what you
> think).


so best will be to configure a seperate transport for ldap virtual users
that uses the macro, and let the other routers use the default
maildir_home transport for non-virtual users.

> Macros are set in the top part of the config file, before the first
> "begin".


at least it works to set this macro after the router with ldap lookup.
i need this to set the path to the Maildir dynamicly. is there a better
way to do so?


> >.ifdef ${extract{mailMessageStore}{$address_data}}
>
> This isn't exim syntax at all. I'm guessing your installation
> runs a set of files through some preprocessor to produce an
> exim config file, and you got the idea from there? Debian, maybe?
> Perhaps there's a mailinglist dedicated to exim on that installation
> which might better help you?


yes, i use the splitted configuration scheme from debian, but this is
indeed exim4 syntax.

i have the following configuration:
--snip--
# macros:
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}))}}
GET_CATCHALL_DATA = ${lookup ldap \
    {ldap:///BASEDN??sub?(&(uid=catchall@${quote_ldap:$domain}))}}


# routers:
lookup:
driver = redirect
address_data = GET_ADDRESS_DATA
data =

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

${extract{mailMessageStore}{$address_data}} is the value of
mailMessageStore out of the ldap lookup result in $address_data.

what's wrong with that?

or do you mean the usage of .ifdef? is it for exim4 macros only? how can
i verify that ${extract{mailMessageStore}{$address_data}} has a value
before setting MAILDIR_HOME_MAILDIR_LOCATION?

bye
jonas