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

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

--On Monday, March 21, 2005 1:14 PM -0500 "Eclipse WebMaster (Denis Roy)" <webmaster@eclipse.org> 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!

One of the beauty's of perl is its easy string manipulations.

Why not just strip off "dn=" and pull in the first part before the first comma (uid=droy) and search with that as your filter. That should be two or three perl statements.

$filter = $dn;
$filter = s/^dn=//;
($filter,$rest) = split /,/,$filter,2;

(off the top of my head, may not be syntactically valid).


Quanah Gibson-Mount
Principal Software Developer
ITSS/Shared Services
Stanford University
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html

"These censorship operations against schools and libraries are stronger
than ever in the present religio-political climate. They often focus on
fantasy and sf books, which foster that deadly enemy to bigotry and blind
faith, the imagination." -- Ursula K. Le Guin