On Thu, Dec 02, 2010 at 11:28:47AM +0100, S??nke Schwardt-Krummrich wrote:

> I'm using postfix 2.5 and configured LDAP as lookup table for my virtual map 
> like this:
> 
> ldapvirtualfoobar_server_host = ldap://myserver:389
> ldapvirtualfoobar_search_base = dc=my,dc=ldap,dc=base
> ldapvirtualfoobar_query_filter = (&(objectClass=someClass)(someAttribute=%s))
> ldapvirtualfoobar_result_attribute = mail
> ldapvirtualfoobar_result_filter = %s
> 
> The main problem is that "mail" is a multivalue attribute

In the LDAP email schemas I am familiar with, "mail" is the *primary*
email address, and is not multi-valued. It is unfortunate that it is
multi-valued in your particular schema. We have:

        mail:                   primary-rfc822-email-address; single valued
        mailalternateaddress:   primary-address
        mailalternateaddress:   other-address1
        mailalternateaddress:   other-address2
        mailalternateaddress:   ...
        mailalternateaddress:   multi-valued
        maildrop:               mailbox-destination; single-valued

> Is there any way to return only one address by LDAP query if result_attribute 
> is a multivalue attribute? It doesn't matter which one of the values is 
> returned.

No, the LDAP driver has no support for choosing one from a set of returned
values. The best you can do is choose any other single-valued attribute
then return the original lookup key via "result_format = %S".

        query_filter = mail=%s
        result_attribute = cn
        result_format = %S

This is not useful if you want to coerce alternative address forms to the
primary address, but can be useful if you just need identity mappings.

-- 
        Viktor.

Reply via email to