N
Ninja67
I have the following code on a Windows 2003 server:
#---------------------------------------------------------------
#!C:/Perl/bin/perl.exe
use warnings;
use Net::LDAP;
use Net::LDAP::LDIF;
my @we_want = qw(cn mail telephoneNumber givenName);
$HOST = 'FTWWDDCNP002';
$ldap = Net::LDAP->new($HOST);
$ldap->bind ; # an anonymous bind
my $mesg = $ldap->search( filter=>"(cn=c*)", attrs=>[@we_want],
scope=>'sub');
my $count = $mesg->count;
print "$count matches retrieved from LDAP.\n";
$ldap->unbind; # take down session
exit;
#---------------------------------------------------------------
I installed the necessary modules and the script does indeed run, but
it always returns immediately with 0 matches. If I change the base
attribute to be more specific, it returns some matches, but they are
only from the root. It's as if it is ignoring my scope parameter. I
tried leaving the scope off since the derfault is already "sub" but
that didn't make a difference.
I'm able to connect open and view all of the LDAP fields when using the
free utility BeaverTail. Also, I the same query works perfectly from a
different server using VisualBasic.
Any suggestions appreciated.
#---------------------------------------------------------------
#!C:/Perl/bin/perl.exe
use warnings;
use Net::LDAP;
use Net::LDAP::LDIF;
my @we_want = qw(cn mail telephoneNumber givenName);
$HOST = 'FTWWDDCNP002';
$ldap = Net::LDAP->new($HOST);
$ldap->bind ; # an anonymous bind
my $mesg = $ldap->search( filter=>"(cn=c*)", attrs=>[@we_want],
scope=>'sub');
my $count = $mesg->count;
print "$count matches retrieved from LDAP.\n";
$ldap->unbind; # take down session
exit;
#---------------------------------------------------------------
I installed the necessary modules and the script does indeed run, but
it always returns immediately with 0 matches. If I change the base
attribute to be more specific, it returns some matches, but they are
only from the root. It's as if it is ignoring my scope parameter. I
tried leaving the scope off since the derfault is already "sub" but
that didn't make a difference.
I'm able to connect open and view all of the LDAP fields when using the
free utility BeaverTail. Also, I the same query works perfectly from a
different server using VisualBasic.
Any suggestions appreciated.