David Brossard
David Brossard

Reputation: 13834

In an LDAP search filter, is it possible to ask for the 1st, 2nd, nth, or last value of a multi-valued field?

Using a search filter, is it possible to retrieve the last value of a multi-valued field for an object e.g. the department field of the inetOrgPerson?

For instance, if my user cn=Alice has 2 values for department, can I somehow write a search filter that will return the last value only?

Thanks.

Upvotes: 0

Views: 991

Answers (2)

Thomas Kläger
Thomas Kläger

Reputation: 21435

I found a draft for ordered entries and values:

https://datatracker.ietf.org/doc/html/draft-chu-ldap-xordered-00

If your LDAP server implements this schema extension you might succeed in searching for the nth value of a multi-valued attribute

Upvotes: 1

Ludovic Poitou
Ludovic Poitou

Reputation: 4868

LDAPSearch filters are meant to find and filter LDAP entries. In the LDAP request, the list of attributes to retrieve is a separate parameter from the filter. An LDAP Extension (a Control) exists to specify to match and retrieve only matching values of a multi-valued attribute, specified in RFC 3876. This extension is not implemented in all LDAP directory services, nor in all LDAP clients.

Upvotes: 2

Related Questions