RE: ldap search problem.

Andrew Meng <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.ldap
Message-ID <[email protected]>
John,

 

It turns out to be a "user not found" error(error code 525).  In ldp.exe, I need to specify the Windows domain name during the bind operation. So my follow-up question is how I specify the Windows domain in which that id was? 

 

I try:

 

$ldap->bind("id@mydomain", password=>"password") or die 'Could not bind';
$ldap->bind("mydomain\id", password=>"password") or die 'Could not bind';

 

none is working.

 

Thanks a lot,

Andrew

 


 
> From: [email protected]
> To: [email protected]
> Date: Sat, 6 Feb 2010 22:47:04 -0500
> Subject: RE: ldap search problem.
> 
> It looks just like the code I am using which works.
> 
> Try adding this and see if you get any error messages:
> 
> $ldap->debug(12);
> 
> -----Original Message-----
> From: Andrew Meng [mailto:[email protected]] 
> Sent: Friday, February 05, 2010 2:02 PM
> To: [email protected]
> Subject: 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?
> 
> 
> 
> Thanks a lot in advance!
> 
> Andrew
> 
> _________________________________________________________________
> 
 		 	   		  
_________________________________________________________________
Check your Hotmail from your phone.
http://go.microsoft.com/?linkid=9708121
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.