Chris,
Thanks for your help. Currently, I am binding with this line:
$ldap->bind("cn=WVAdmin,cn=examplename,st=wv,c=us");
and the return code is 0 which I understand indicates success. However,
the search result is limited to the single object
'cn=examplename,st=wv,c=us' despite the presence of several objects with
dn's like cn=<name>,cn=examplename,st=wv,c=us.
I've suspected that maybe I simply don't understand the search mechanism.
I had assumed that the base of cn=examplename,st=wv,c=us would direct the
search through elements with dn's ending with the string '
cn=examplename,st=wv,c=us' like
cn=<name>,cn=examplename,st=wv,c=us. Is this a correct assumption?
Thanks,
Sonya
Chris Ridd <[EMAIL PROTECTED]>
07/16/2004 09:49 AM
To
<[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
cc
Subject
Re: perl-ldap with ADAM
On 16/7/04 5:03 pm, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
> Good morning,
> I have set up a MS ADAM instance named cn=examplename,st=wv,c=us. On
> install, the LostAndFound, Roles, and NTDS Quotas objects were created
> with dn's CN=LostAndFound,CN=examplename,ST=wv,C=us, CN=NTDS
> Quotas,CN=examplename,ST=wv,C=us, and
CN=Roles,CN=examplename,ST=wv,C=us.
> This all displays successfully in ADAM ADSI Edit.
>
> I then added via importing an ldif file a couple of object instances
with
> dn's CN=WVAdmin,CN=examplename,ST=wv,C=us and
> CN=WVAdmin2,CN=examplename,ST=wv,C=us. These both also display
> successfully in ADAM ADSI Edit.
>
> So then I attempt to use perl-ldap to perform a search like this:
>
> use Net::LDAP;
>
> $ldap = new Net::LDAP('localhost') or die "$@";
> $ldap->bind( version => 3 );
>
> $mesg = $ldap->search ( base => "C=us",
> filter => "objectClass=*",
> ) or die ("Failed on search.$!");
>
> foreach $entry ($mesg->all_entries)
> {
> $entry->dump;
> }
>
> $ldap->unbind;
>
>
> The result is no entries. I have also tried narrowing the base to
> CN=examplename,ST=wv,C=us with no benefit. Additionally, I tried
binding
> to cn=WVAdmin,cn=examplename,st=wv,c=us which does return a single
result
> with dn=examplename,st=wv,c=us.
>
> Does anyone have any ideas what I might be doing wrong?
The die() will not be called unless there was some problem constructing
the
operation to send to the server. To find out what's happened to the search
you should look at the values of $mesg->code, $mesg->error_name, and
$mesg->error_text afterwards, ie before your foreach loop.
I also believe MAD requires you to bind before allowing a search
operation.
Cheers,
Chris