Re: ldap search problem.

[email protected]
Newsgroups perl.ldap
Message-ID <766126065.976691265571294314.JavaMail.root@sz0165a.westchester.pa.mail.comcast.net>

I keep getting your email traffic, can you delete me?? 



thanks, 
----- Original Message ----- 
From: "Clément OUDOT" <[email protected]> 
To: "Andrew Meng" <[email protected]> 
Cc: [email protected] 
Sent: Sunday, February 7, 2010 9:57:18 AM GMT -05:00 US/Canada Eastern 
Subject: Re: ldap search problem. 

> 
> Hello, 
> 
> 
> 
> LDAP search failed to return any result but I can get the result back 
> using the same base and filter in ldp.exe. Here is the code: 
> 
> 
> 
> !/usr/bin/perl 
> 
> 
> use Net::LDAP; 
> 
> 
> 
> $ldap = Net::LDAP->new("server", port =>389) or die 'Could not contact 
> LDAP server'; 
> 
> $ldap->bind("cn=id,DC=aa,DC=bb", password=>"password") or die 'Could not 
> bind'; 
> 
> 
> 
> $mesg = 
> $ldap->search(filter=>"(&(objectCategory=person)(objectClass=user)(sn=name))", 
>  base=> "DC=aa,DC=bb",  attrs=> ['sAMAccountName'] ); 
> 
> 
> 
> @entries = $mesg->entries; 
> 
> 
> 
> foreach $entry (@entries) { 
>         @attrs = $entry->attributes(); 
>         foreach $attr (@attrs) { 
>                 printf("\t%s: %s\n", $attr, $entry->get_value($attr)); 
>         } 
> } 
> 
> 
> $ldap->unbind; 
> 
> 
> 
> 
> 
> Does anyone know what is wrong? 

You should maybe set the scope in you search method. 

Clément.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.