[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ldapsearch using dn= as the filter returns no results.

Eclipse WebMaster (Denis Roy) wrote:


After Googling this for about an hour, I decided to post here. If I issue the following command:

$> ldapsearch -x -LLL "uid=droy"

I get:
dn: uid=droy,ou=people,dc=eclipse,dc=org
cn: Denis Roy

However, if I try a search using my DN, I can never get a result:
ldapsearch -x -LLL "dn=uid=droy,ou=people,dc=eclipse,dc=org"

I'm writing a Perl application where I have the user's DN, and need their mail address. Unfortunately, perl's ldap->search using the DN as a filter behaves the same way.

Any help or pointers on how to search for entries based on the DN would be appreciated!

That is not the way DNs are used, and "dn" is not an actual attribute, so it cannot be specified in a filter.

When you know the DN of an entry, there is no need to "search" for it all, just retrieve the entry directly:
ldapsearch -x -LLL -b "uid=droy,ou=people,dc=eclipse,dc=org"

 -- Howard Chu
 Chief Architect, Symas Corp.       Director, Highland Sun
 http://www.symas.com               http://highlandsun.com/hyc
 Symas: Premier OpenSource Development and Support