Grr... Thanks... Works perfectly now. 

> -----Original Message-----
> From: Barrett, John [mailto:[EMAIL PROTECTED] 
> Sent: Monday, April 11, 2005 5:50 PM
> To: Young, Darren; [email protected]
> Subject: RE: Query against Active Directory
> 
> Try using $binduser instead of $binddn in your ldap->bind call.
> 
> -----Original Message-----
> From: Young, Darren [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 11, 2005 3:30 PM
> To: [email protected]
> Subject: RE: Query against Active Directory
> 
> 
> 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]
> > 
> 
> *****
> 
> The information transmitted is intended only for the person 
> or entity to which it is addressed and may contain 
> confidential, proprietary, and/or privileged material. Any 
> review, retransmission, dissemination or other use of, or 
> taking of any action in reliance upon this information by 
> persons or entities other than the intended recipient is 
> prohibited. If you received this in error, please contact the 
> sender and delete the material from all computers. 117
> 
> 
> 

Reply via email to