Sorry, I didn't catch the start of this thread.  Are you sure the object
actually exists under the search base?  If so, are you sure your bind DN
has permissions to it?


On Mon, 11 Apr 2005, Young, Darren wrote:

> Same results:
> 
> #!/usr/local/bin/perl
> 
> use Net::LDAP;
> 
> my $host       = "gsbad1";
> my $port       = 389;  
> my $binduser   = "CN=xxxxxx,CN=Users,DC=gsb,DC=uchicago,DC=edu";
> my $bindpass   = "xxxxxx";
> my $connstring = "$host" . ':' . "$port";
> my $basedn     = "dc=gsb,dc=uchicago,dc=edu";
> my $login      = "dyoung2";
> my $filter     = "(sAMAccountName=" . $login . ")";  ### changed
> 
> my $ldap       = Net::LDAP->new($connstring);
> 
> if ( $ldap->bind( $binddn, password => "$bindpass" ) ) {
>     print "successful bind to $host:$port\n";
> } else {
>     print "can't bind to ldap server $host:$port ($@)\n";
>     exit;   
> }
> 
> print "filter: $filter\n";
> $mesg = $ldap->search( base   => "$basedn",
>                        scope  => 'sub',
>                        filter => "$filter"
>                        );      
> 
> if ( $mesg->code ) {
>     print "FAILED: error is: " . $mesg->error . "\n"; 
>     exit;   
> } else {
>     print "found " . $mesg->count . " entries\n";
> 
>     foreach $entry ( $mesg->entries ) {
>         $entry->dump;
>     }
> }
> 
> if ($ldap) {
>     $ldap->unbind;
> }
> 
> Results: 
> 
> successful bind to gsbad1:389
> filter: (sAMAccountName=dyoung2)
> found 0 entries
> 
> ~                                                                   
> 
> > -----Original Message-----
> > From: Vladimir Levijev [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, April 11, 2005 3:23 PM
> > To: [email protected]
> > Cc: Young, Darren
> > Subject: Re: Query against Active Directory
> > 
> > On Monday 11 April 2005 23:11, Young, Darren wrote:
> > 
> > Hi,
> > 
> > How about changing filter a bit:
> > 
> > > $mesg = $ldap->search( base   => "$basedn",
> > >                        filter => "(sAMAccountName=$login)"
> > >                        );
> > 
> > filter => "(sAMAccountName=" . $login . ")"
> > 
> > Regards,
> > 
> > --
> > [EMAIL PROTECTED]
> > 
> 

-- 
Craig Dunigan
IS Technical Services Specialist (I don't know what it means, either)
Middleware - Enterprise Info Systems - Department of Info Technology
University of Wisconsin, Madison

opinions expressed are my own, not the University's

Reply via email to