[exim] Ugly configuration with nested LDAP lookups (space as…

Etusivu
Poista viesti
Vastaa
Lähettäjä: Heiko Schlittermann
Päiväys:  
Vastaanottaja: exim users
Aihe: [exim] Ugly configuration with nested LDAP lookups (space as delimiter?)
Hello,

yesterday I configured an Exim server to do LDAP queries, but somehow
I'm not satisfied. May be I was blind or too stupid ...

In some LDAP directory (here: ADS) there are "mail groups"

    dn: cn=edv,ou=mailgroups,o=org
    mail: edv@???
    member: cn=hans,ou=users,o=org  <- CN here, no mailbox
    member: cn=paul,ou=users,o=org     ... or mail address



The user objects look about like this:

    dn: cn=hans,ou=users,o=org
    cn: hans
    mbox: hans
    mail: hans@???



If I do a LDAP query like this

    GROUP_QUERY=${lookup \
      ldap {ldap:///ou=mailgroups,o=org\
            ?member?sub?(mail=$local_part@$domain)}}


it returns the list (as I seen in the debug output):

    cn=hans,ou=users,o=org, cn=paul,ou=users,o=org


This list I have to resolve. I tried ${map {}{}}, but map expects
":" as delimiter, I tried to change it using

    ${map {<\x20 GROUP_QUERY}{ ANOTHER QUERY TO MAP 'dn' to 'mbox' }}


but somewhow w/o success... it looked like exim was not accepting the
\x20 as delimiter...

1) So - is it supposed to work as I tried?
2) Or is there some way to change the outputs delimiter to ":" instead of
", " or " "?

Last but not least here is my current *ugly* solution, just pasted w/o
any explantion, it works, but there are not serviceable parts inside ;-)

    verteiler:
      driver = redirect
      data = ${sg {${map {${sg{${lookup \
             ldap{LDAP_CRED \
             ldap:///ou=e-mailgroups,GBASE\
                    ?member\
                    ?sub\
                    ?(mail=${quote_ldap:$local_part@$domain})}}}{, }{:}}}\
            { \
                    ${lookup ldap{LDAP_CRED ldap:///$item?mbox??}} \
            }}}{:}{, }}


Thanks.
--
Heik