Re: [Exim] extract, address_data and ldap!

Góra strony
Delete this message
Reply to this message
Autor: Nico Erfurth
Data:  
Dla: Adam Cassar
CC: exim-users
Temat: Re: [Exim] extract, address_data and ldap!
Adam Cassar wrote:
> Hi Guys,
>
> I am hoping someone can help me with a sticky configuration.
>
> I am doing an ldap query and sticking it in address_data like so:
>
> address_data = ${lookup
> ldap{ldap:///uid=${quote_ldap:${local_part}}@${quote_ldap:${domain}},cn=${quote_ldap:${domain}},ou=webmail,dc=test,dc=com?base}{$value}{fail}
>
> which returns me something like:
>
> objectClass="top, inetLocalMailRecipient, posixAccount, person"
> cn="pump" uid="pump@???" mail="pump@???"
> mailLocalAddress="pump@???" userPassword="pump" uidNumber="10000"
> gidNumber="10000" homeDirectory="/webmail/mail/t/e/test.com/pump/"
> mailQuota="1000M"
>
> Now what I want to do is use extract to get the data from the
> objectClass field. However you will notice
>
> objectClass="top, inetLocalMailRecipient, posixAccount, person"
>
> But I want to check for ${extract{objectClass}{objectClass="top,
> inetLocalMailRecipient, posixAccount, person"}}
>
> Which obviously won't work. So I tried using ${sr to change ', ' to be
> 'objectClass=' so it ends up with multiple objectClass= variables.
> However as there are multiple entries it always returns the first one -
> but I want to check for the existence of lets say objectClass=person.


Can't you do this in the ldap-filter?

like this? (if you want to check for posixAccount)

address_data = ${lookup\
ldap{ldap:///uid=${quote_ldap:${local_part}}@${quote_ldap:${domain}},\
cn=${quote_ldap:${domain}},ou=webmail,dc=test,dc=com?base?\
(objectClass=posixAccount)}{$value}{fail}